JPEG compression maps
Submitted by Albert Cahalan
Link to original bug (#331798)
Description
When saving a JPEG, let me supply a map like this:
black = max compression grey = medium quality and compression white = max quality
(or the other way around)
The idea is to let the user choose max quality for important (foreground) parts of the image, and max compression for the unimportant (background) parts of the image.
I suppose that each color channel of the map ought to apply to a color channel of the result. (green for Y, red for Cr, blue for Cb) Normally one would just use greyscale; conversion of the map ought to happen as needed.
The easiest place to put the map is at the bottom of the layer stack. That way it is saved in XCF files, but it doesn't show up in the JPEG unless someone is weird enough to want that. Probably the user should get a down-down that lets them choose a layer, layer mask, other image, or none. ("none" meaning to enable the normal global quality value settings)
Compress a block at the highest quality setting found in the map area describing that block. (well, better would be to control things at a level that is smaller than a compression block, considering the vertical and horizontal DCT separately... but that sounds really painful to implement)
Rather than just disabling or ignoring the normal quality setting, it might be better to give the user two settings: one for the black parts of the map, and one for the white parts of the map. Then there is no need to change the map when one wants to tweak the settings a bit. This also eliminates the need to decide if max quality is represented by black or by white.