3 ms·
This is a source of pain in web dev, too - we convert uploaded images to srgb so they display as consistently as possible across devices - and generally clients
by madaxe_again 11y ago
This is a source of pain in web dev, too - we convert uploaded images to srgb so they display as consistently as possible across devices - and generally clients save in srgb. It's when they upload Adobe rgb images that get auto-converted that the fun starts, as the effect is usually one of the image appearing "washed out".
Curious if anyone has come up with a clever solution to this one.
- jacobolus 11y agoWhat does “auto converted” mean in this context? If you know the image is Adobe RGB (e.g. it has an embedded color profile, or has an "Adobe RGB" metadata tag) then you should either keep that metadata around, or if you want to turn it into an sRGB image you’ll need to convert the colors of every pixel. Since the Adobe RGB gamut is larger than the sRGB gamut, for some images you’ll need to map out-of-gamut colors into the sRGB gamut, either by hard clipping them (I recommend clipping along constant hue/lightness lines in CIELAB or CIECAM02 space) or by doing a more sophisticated transformation. There are lots of possible choices to make when gamut mapping. If you’re interested in the details there was a ~1000 page book published on the subject a few years ago. :-) (Or the easy thing is to just let some existing color management software like Apple ColorSync, LittleCMS, or whatever Adobe’s thing is called handle the gamut mapping for you, though in my opinion they all do a relatively mediocre job, unfortunately.) If you don’t know the image was Adobe RGB – i.e. the metadata was stripped out before it got to you – then there’s not a lot you can do, unless you want to examine the color content of the image and come up with some kind of heuristic for guessing the color space.
- madaxe_again 11y agoYeah, it's usually the latter - and when we do know it's Adobe RGB we do exactly what you recommend, going via CIELAB - but it's not precise, and clipping does occur. We're leaning towards "please upload a valid image" as a solution, which is a shame, but the whole perceptual end of things makes doing this automatically nigh on impossible - can't come up with a solution that works for all cases.
- jacobolus 11y agoWhen there’s no profile or metadata included, you could show the uploader an image preview and give them a choice of color spaces.