Select color (with tolerance level regarding hue/saturation/brightness) & replace with other color (fixed or tolerance)

The right place to speak and share about your experiences of GraphicConverter
Post Reply
porg
Posts: 554
Joined: Tue Apr 05, 2022 1:04 pm
Country: Austria

Select color (with tolerance level regarding hue/saturation/brightness) & replace with other color (fixed or tolerance)

Post by porg »

Is this possible in GraphicConverter to replace a color with another color in a whole image without any need for a selection?
- Ideally you could select the color with a tolerance level each per color attribute (hue/saturation/brightness).
- And when replacing either replace it with a particular color without any tolerance or say I want to replace it with some tolerance again each per hue/saturation/brightness.
- I searched the forum (with Google because in its current configuration forum search is still useless) and seemingly EXIF Sync offers a function with that name at least. But I did not find any "replace color" functions in the menu structure of GraphicConverter.

Example
- Let's say I have a website screenshot, and quickly want to try changing the color theme.
- Let's say we have primary buttons in purple, normal text in black, link text in dark blue and some other colors in the content.
- Let's say I want to transform the buttons to the same color as link texts.
-- GraphicConverter has a feature "Swap Colors…", but in this case it won't do the job. Instead of primary buttons and link text ending up both in dark blue, they will swap (as the name indicates), so the primary buttons will be dark blue and the link text will be purple.
-- The workaround would be to swap to an auxiliary color nowhere else in the image (i.e. magenta) and then swap from that auxiliary color to your intended color.
-- Not very convenient.
-- And also it only works for exactly one color without any tolerance. So in the case of dark blue link text, some a bit lighter shades of blue from the font-anti-aliasing will not be selected, and will remain as an ugly remainder.


I'd imagine the "Replace Color" dialog like this:

Code: Select all

      SOURCE COLOR  🟪 🖋

               Hue: 171°   0 .......>|<....... 359
        Saturation:  60%   0 ..........>|<.... 100
         Lightness:  97%   0 .............>|<. 100

 Visualization aid:  [ ---                     ▾ ]


 DESTINATION COLOR  🟦 🖋

                                                  Fixed?
               Hue:  35°   0 ...|............. 359  ☑️
        Saturation:  60%   0 ..........|...... 100  ☑️
         Lightness:  92%   0 ...............|. 100  ☑️

Fixed:
  • This attribute of the replacement color gets set to exactly that value.
  • If unchecked, you can set what amount (in ° or %) of this
    color attribute is transferred from the source to the destination color.


                                             [ Cancel ] [ APPLY ]
Behavior:

Slider at the source color
- Sets a from-to value
- Ideally has CENTRAL handle in order to move the single value plus additional FROM and TO to widen/narrow.
- If only FROM and TO handles are possible, then make sure they push each other, as a somehow convenient workaround.

Slider at the destination color:
- Is a single value
- If Fixed is unchecked the first time, then it resets to 0 (transfer nothing over!).
- Bot from then on, the values of both modes shall be remembered. So when toggling this on/off the last value of the other mode is remembered.

Visualization aid offers these choices:
- ---
- Matched pixels as red tones
- Matched pixels as grayscales
- Matched pixels opacity + nearby opens: Num-Input 0-100 plus slider
- Matched pixels saturation + nearby opens: Num-Input 0-100 plus slider
-
- Unmatched pixels as red tones
- Unmatched pixels as grayscales
- Unmatched pixels opacity + nearby opens: Num-Input 0-100 plus slider
- unmatched pixels saturation + nearby opens: Num-Input 0-100 plus slider

This visualization aid is for the the instant preview on the canvas while the dialog is open.
When clicking APPLY, the real color replacement happens, and the dialog closes.
porg
Posts: 554
Joined: Tue Apr 05, 2022 1:04 pm
Country: Austria

Re: Select color (with tolerance level regarding hue/saturation/brightness) & replace with other color (fixed or toleran

Post by porg »

In addition to this single color approach with tolerance, when having graphics with clear sharp colors the following approach could be useful:
Identify all colors in graphic (with treshhold) and then do on-the-fly color changes
User avatar
forum_adm
Site Admin
Posts: 1814
Joined: Fri Dec 23, 2016 9:41 am
Location: Germany
Country: Germany
Contact:

Re: Select color (with tolerance level regarding hue/saturation/brightness) & replace with other color (fixed or toleran

Post by forum_adm »

Yes, simple use Edit -> Find/Compare/Replace -> Find and Replace Color
Screen Shot 2022-06-30 at 07.45.jpg
Screen Shot 2022-06-30 at 07.45.jpg (69.62 KiB) Viewed 679 times
porg
Posts: 554
Joined: Tue Apr 05, 2022 1:04 pm
Country: Austria

Find and Replace Color

Post by porg »

1) Thanks! Glad that GC already has such a feature. Had searched the Help menu for "color" (and also "colour") but it's limited to 10 results (as I learned later) and GC has more than 10 "color" entries in its huge menu structure. Also browsed the menu structure. But that part I have missed.

2) On the dialog > General things

a) "Replace Color" should be "Replacement Color". "Replace Color" is wrong and actually more synonymous with "Search Color" in that context. In English you "replace X with Y". So "Y is the replacement for X".

b) Dialog as a modal windows: Impacts productivity quite noticeable here: Ideally you could zoom the canvas while tweaking parameters to judge the effects both in totale and in details. Not possible with a modal dialog window. Workaround: Close dialog, zoom/pan, open dialog with shortcut. The last values are remembered at least, the best possible compromise, good!

3) On the feature itself

a) 👍 Replace with transparency: Cool feature. Then the replacement can be visualized with the Replacement Color during preview and afterwards you see it with the checkerboard.

b)❓ Tolerance Slider What exactly does it operate on? From observation I'd say that it is a mix of saturation/lightness and on higher values also hue to some degree. As-is it has little practical value for me. I have difficulty selecting the blue anti-aliased text with this. When the tolerance level is high enough that nearly the whole font-seam is selected a lot of totally unrelated parts of the image (even black text!) is already selected.

👉 I' propose 3 separate tolerance levels per each color attribute: hue, saturation, lightness. I could then select the hue with a narrow band (0, at max maybe 5 of 360°) and only play with the lightness/saturation slider to select the font-seam, but not too much else of the picture.

c)💡 Select nearby pixels: I got this idea during testing. So in additon to the 3 tolerence levels which select the color quite narrowly/exactly, to get the last seam-stuff, which may also bleed into some neighboring colors other than white, this would help. So the pre-existing selection from Search Color + Tolerance Levels is then extended "geographically" with two parameters: Size (in pixels) and softness (in pixels).

So this would be a combination of color-selector plus magic wand, but all parametrically.

d)💡 Visualization Aid I proposed, so that you do not need to "abuse the replacement color temporarily" as an auxiliary color as you need to do in the dialog in its current form when being in situations where you need to understand what is in the selection and what not.


In this ▶️ video (5:34, 7 accessible chapters, 7.6 MB, Dropbox) I showcase an example at hand (light blue text shall get transformed into black text), the challenges I face, what the current capabilities of "Find and replace colors" make possible for me (tutorial: see it in action!) and what not, and which of my proposed parameters would (supposedly) help/improve the workflow here and there..
Post Reply