plug-ins: export linear JPEG if and only if the work image was 8-bit...
... linear itself AND if we export the profile. In most cases we want to save 8-bit image formats (here JPEG) as non-linear, even though the work image may have been linear itself (yet with higher bit depth). The reasons are shadow posterization on low bit depth, and the fact that JPEG compression was designed for perceptually uniform RGB and introduces shadow artifacts with linear RGB (see #1070, message by Elle Stone). The only exception is when the creator was working explicitly on 8-bit linear (not higher bit depth) AND if we export the profile (otherwise most loaders around assume sRGB). In such a case, let's consider the creator knows what one is doing and keep the exported image linear. Similar logics is already used in PNG exporter (though a bit of a variant since PNG supports 16-bit so it is instead: 8-bit linear without profile is promoted to 16-bit non-linear, and kept 8-bit linear with profile).
Showing with 52 additions and 24 deletions