Closed sophie-h closed 1 year ago
The individual format crates cannot support DynamicImage
because of a circular dependency issue: image
dependends on the format specific crates to provide its various decoders, but those crates would need to depend on image
if they wanted to access DynamicImage
.
I think a good first step would be to add a ImageDecoder::icc_profile(&mut self) -> Option<Vec<u8>>
method that defaults to returning None. After calling it, you can then use DynamicImage::from_decoder
to get the rest of the image.
I would like to be able to convert images to sRGB (or other profiles in the future.) The specific
png
andjpeg-decoder
crates support accessingicc_profile()
that I can use with thelcms2
crate but, they do not supportDynamicImage
. Theimage
crate does not support accessing the color profile information but supportsDynamicImage
.My specific use case for this functionality is writing a new image viewer for GNOME.
This might be more generally applicable to other features like EXIF block data or background colors (bKGD).
Draft
ImageDecoder
returningNone
if not applicable.DynamicImage
support to the specific crates. Webp already has that.image::codecs::png::PngDecoder
. However, not sure if that's possible for EXIF where the end of the file is relevant?