plug-ins: follow the assigned profile TRC.
GIMP should not convert assigned profile to sRGB just because we stored as linear on the XCF. In other words, we should not look at the image precision to decide whether to export as linear (previously only 8-bit linear images), but at the profile TRC. There are basically 3 cases: (1) We don't save a profile, then convert to sRGB whatever the source precision (because readers would assume sRGB for a no-profile jpeg). (2) We save the default profiles: convert to sRGB because it's usually a better choice for 8-bit formats and even working at 32-bit float *linear* doesn't mean you want to export as 8-bit int *linear*. As the image creator made no explicit export choice, we make an acceptable default one. (3) We save an explicitly assigned profile: keep the profile TRC, don't convert! Note that this apparently won't work perfectly right now, as GIMP replaces the original TRC with the linear default TRC when converting to linear. So the expected TRC is lost in such case when you have not explicitly reset the correct profile. Yet this is on GIMP side and this part of the issue should be fixed with the space invasion merge. For now, this is how the plug-in should work. This is based on my late discussion with Ell. Please everyone, and Ell especially, review! :-) (cherry picked from commit c5f7bac2)
Showing with 34 additions and 63 deletions