Colors that should not be modified during RGB->Indexed conversion
Submitted by Raphaël Quinet
It would be nice to have a way to select one or several colors that should not be averaged or otherwise modified when generating an "optimal palette" for the RGB->Indexed conversion.
For example, if I select black (#000000) and white (#ffffff) among the colors to be preserved and then I convert an RGB image to indexed mode using the option "Generate Optimal Palette", then these colors will not be averaged with another color when creating the new palette. So if the image contains some areas that are black or white (and no dithering is used) then these areas will keep the exact same color. If the image did not contain any black or white pixels, then the palette will be generated as before, without any constraints.
One way to present that in the user interface would be to add an option below the existing "Generate Optimal Palette" option that would labeled as "Generate Optimal Palette and Preserve Colors from [palettes menu]" (Any ideas for a better wording?). If the image contains any color from the selected palette, they would first be copied to the new palette. After that, the other colors are allocated (up to the maximum allowed) using the same algorithm as before.
So the user could for example select the web-safe color palette and any parts of the image containing one of these colors would still be web-safe after the conversion to indexed mode (but this is different from the "Use Custom Palette" option because the other colors could still be allocated freely). Another example would be to create a palette containing some "important" colors (spot colors for a corporate log or colors used for chroma keying in some applications); these colors would be preserved in the indexed image.
This enhancement would be another way (slightly more complicated) to solve the problem described in bug #66257. I consider the solution described in #66257 as a quick fix for the bug (maybe suitable for 1.2.x) and this one as an enhancement that provides a better solution (for 1.3.x or later).
Version: git master