-
Notifications
You must be signed in to change notification settings - Fork 686
Description
The problem
There is a number of formats that are implemented as third-party crates, but are not supported by image:
JPEG XL: https://crates.io/crates/jxl-oxide
RAW: https://crates.io/crates/rawloader or https://crates.io/crates/quickraw
PSD subset: https://crates.io/crates/zune-psd or https://crates.io/crates/psd
ICNS: https://crates.io/crates/icns
JPEG 2000: https://crates.io/crates/openjp2 (not sure if the port is complete enough just yet)
None of these formats have specifications available publicly and for free. As per #1979, right now they are not supported by image at all.
This leads to each API users that needs them reimplementing the integrations into image. oculante has already done this, and I'm going to have to do this in wondermagick too.
Possible solutions
Adding image integrations to those crates (like it's done for libwebp) is a step in the right direction, but doesn't really solve this because the API is still quite awkward: you cannot just use reader.with_guessed_format().decode()?, the API user has to explicitly list every format and also deal with magic numbers for them.
Also, when image ships a new semver-incompatible version, every integration would have to bump their semver as well, and it could take a long while until all the format integrations are upgraded.
A solution that seems promising to me is a tiered format support, where we specifically advertise third-party crates listed above as Tier 2. We clearly state that we do not accept bug reports about them and that any issues should go to the third-party crate's issue tracker. These formats would also be disabled by default, with explicit opt-in required to enable them.
This avoids the issues with the other option, but still adds some (hopefully small) additional maintenance burden for the in-tree integration of the third-party crate.
Thoughts? Any other good options I've missed?