Hey all! I'm the developer of pict-rs, the image host API used by lemmy. I'm here to officially announce the availability of the pict-rs 0.3 beta releases. As I type this, v0.3.0-beta.3 is currently building and should be published to dockerhub shortly. Here's what's new
There are now APIs to fetch metadata about images. These endpoints are mentioned in pict-rs's README.md, but at a high level they can return mime-type, dimensions, and creation date for original or processed images
The rest of the pict-rs APIs have not changed, so if you experience different behavior, please let me know in the [#pict-rs:matrix.asonix.dog](https://matrix.to/#/#pictrs:matrix.asonix.dog) channel on matrix.
pict-rs no longer links against imagemagick, ffmpeg, and gexiv2. This change makes developing on pict-rs significantly easier, since it now compiles like a normal rust application with very few system dependencies. This also means it can be easily linked against the musl standard library to create a static executable.
Instead of linking against the programs mentioned above, pict-rs will now spawn imagemagick, ffmpeg, and perl-image-exiftool processes in order to manipulate images. The required versions are
- Imagemagick: At least 7.0
- ffmpeg: At least 4.0
- perl-image-exiftool: whatever Arch or Alpine are packaging right now
images are now organized into directories by default, and will no longer have original files dumped into the root of `files/`. If upgrading from 0.2, a migration script will attempt to move existing files from their current locations to this new structure. Please please please take a backup of your pict-rs storage directories before upgrading.
pict-rs now supports configuring the service with a file, rather than relying on commandline arguments or environment variables. The majority of settings can still be manipulated through the environment or through the commandline, but there is a specific feature (mentioned below) that can only be accessed through a configuration file. For information on configuring pict-rs, take a look at the [pict-rs.toml file](https://git.asonix.dog/asonix/pict-rs/src/branch/main/pict-rs.toml)
# Object Storage
There is now object storage support built-in to pict-rs. If you already have a pict-rs deployment as part of your lemmy server, there is an included migration feature to help move from your existing block storage to object storage for the image files. This does not completely remove pict-rs dependency on a local filesystem, but all original images and transformed images will be stored in object storage rather than on the local filesystem.
In particular, pict-rs database still resides on the local filesystem, and temporary files created when manipulating images will still use the /tmp directory.
Object Storage has not been tested with any cloud provider, but I have set up a local [minio](https://min.io/) container for local testing. If you try to use pict-rs with your favorite cloud provider and it doesn't work, please let me know in the [#pict-rs:matrix.asonix.dog](https://matrix.to/#/#pictrs:matrix.asonix.dog) channel on matrix.
If you are migrating from local storage to object storage, the specific way to accomplish that is with pict-rs's `--migrate-file <file>` flag, and the associated migration file. An example can be found [here](https://git.asonix.dog/asonix/pict-rs/src/branch/main/migrate.toml)
Finally, object-storage is behind a feature flag, and can be disabled in custom builds of pict-rs by providing the `--no-default-features` flag to cargo when building
Since actix-rt gained support for io-uring with 2.3.0, I have implemented an io-uring file backend for pict-rs. It is disabled by default, as io-uring requires a recent linux kernel release and I don't want to publish an application that doesn't work on most people's computers, but if you are interested in building and running an io-uring version of the application, you can pass `--features io-uring` to cargo to produce an io-uring backed binary rather than traditional blocking file IO.
In my personal testing, io-uring performed significantly better for serving files on my laptop running linux kernel 5.13.
Keep in mind that io-uring in the actix-web ecosystem is currently considered unstable and is therefore exempt from semver, so the io-uring feature in pict-rs should also be considered unstable.
That about wraps up this announcement! Here's some useful links for pict-rs:
- git: https://git.asonix.dog/asonix/pict-rs
- matrix: https://matrix.to/#/#pictrs:matrix.asonix.dog
- dockerhub: https://hub.docker.com/r/asonix/pictrs
- asonix on mastodon https://masto.asonix.dog/@asonix