Open lpy opened 5 years ago
Not sure the backward compatible rules of this project, can API like DefaultDecoder#decodeJPEGFromEncodedImageWithColorSpace be changed?
Hi @lpy
Thanks for suggesting this idea! The approach looks good so far but we would need to discuss more about how to solve it and will come back to you soon.
Upload a pull request, please take a review :) If the direction looks good, I can proceed to sign the CLA, thanks!
Thanks for taking the pull request. That should cover all places that would use the Android decoder, but I am not sure whether there are other places that we should manage the color. Is there any place that decodes images without using the Android decoder?
@Lpy thanks a lot for doing this! There are two places where we decode without proper colour management, but these places are phasing out slowly:
@oprisnik for input regarding the animation backends
Description
Right now ImagePipeline allows to specify whether to transform to srgb and there are some APIs that use this bit. A more future-proof approach would be explicitly passing a target color space.
Before API level 26, Android only recognized all images as sRGB, right now it looks like old APIs just simply pass a
false
to its new variants to not decode to sRGB, which means the encoded color space of the images would likely be the target color space, applications that use the new version of Fresco and run on new OS might end up not getting what they want if they don't do color management, maybe consider only decode images to sRGB color space for old APIs?Solution
Just some thoughts:
Consider updating ImageDecodeOptions to have a ColorSpace, and use it instead of
transformToSRGB
;Update current APIs that accepts
transformToSRGB
to accept aColorSpace
instead;Update old APIs (introduced before API level 26) that don't accept
transformToSRGB
to explicit decode images to sRGB.