I have the following image:

xylophone image

I want to change the colors so that they match my own Xylophone. Since there are in-between colors at the borders, just selecting a color and filling the selected area with my target color is not viable because the in-between colors will stay unchanged. See here (zoomed in), original green color and blue-colored version:

original color

new color

So my preferred approach is to select a larger area that contains all the in-between colors and some black border and colorize that whole selection. That way the main color changes, the in-between colors change accordingly, and black stays black. There are a number of color changing options in GIMP like "color balance", "hue-chroma" or "colorize", and I tried all of them (i.e. the ones I could find in the Colors menu). But I could not find any one that allows me to specify a target color.

Here is my target color:

enter image description here

So I thought I could just type in my RGB values in one of these colorizing options, but I could not find any option that takes an RGB value as input. I tried taking the L-C-h values instead, assuming it is just a different way of specifying RGB values, and entered them in the option "hue-chroma":

enter image description here

But firstly the maximum Hue value in that option is 180, so I could not use my actual value of 281.5 and secondly, this does not look anything like I want it: I expect the black to stay black and only the colors to change. So I am obviously not using that coloring option as intended.

How can I change the color of a selected area so that

  • a specified color (here green) turns into a target color (here blue)
  • white, grey, black stay unchanged
  • in-between colors change accordingly so that the newly colorized image is as smooth as the original ?

Note: I know that I could select the green area close to the black border, grow it a bit, feather it a bit, then fill the selection with my target color. That will also give smooth transitions. But since this depends a lot on exactly where the feathing starts and how far it goes, this is quite fiddly. I am looking for a more robust solution.

  • Hi. The most robust solution would be to recreate the graphic as a vector or find a vector file to begin with, then use a vector image editor such as Inkscape (which is free). Then you could simply change the colour fill. Raster image editors are going to have problems with this because of the low image quality and anti-aliasing in the original image.
    – Billy Kerr
    Commented Jul 24, 2023 at 8:19
  • See a quick example made in Inkscape
    – Billy Kerr
    Commented Jul 24, 2023 at 11:01

3 Answers 3


Your image has a very low quality, with very strong JPEG compression artifacts (and the fact that it was later re-encoded with a better JPEG quality doesn't change anything to this), and these artifacts prevent a proper technique that handle anti-aliasing pixels (remove color by painting in Color Erase mode, re-paint in Behind mode) from working satisfactorily.

You can try Color > Map > Rotate colors to map a range of hues to another (but you can't change saturation/lightness directly).


Using gimp

  1. Make a selection with the "Free select tool" you can make it in the middle of the black line.

  2. Play with the "Hue Croma" tool. Mainly change the hue, but you can also play with chroma.

As the black has no saturation it will not be affected.

enter image description here

You might be tempted to change lightness. If you need it, you need to refine your selection to leave the black out of the selection or select the black (or resulting gray) and re-adjust it.

It is the same solution unpropan mentioned, but using Gimp tools ;)

  • 2
    If you are targeting a specific color, you can create a Sample Point in the area that you want to change, and check how its RGB/HSV/Lch values change as you push the sliders.
    – xenoid
    Commented Jul 23, 2023 at 20:18
  • The point is not a specific color, but the aliasing zone. But, yes, there are many tips for masking.
    – Rafael
    Commented Jul 24, 2023 at 1:11
  • As said in my question, I want to colorize to a given target color. Playing with the tool, moving sliders and hoping to find a color which looks like my target color is no option (eyes - at least mine - are not able to exactly measure colors). I am looking fo a way to INPUT the target color.
    – Kjara
    Commented Jul 26, 2023 at 6:04

Get Krita - it's also free. It's HSV/HSL adjustment filter maybe does in Colorize mode what you expect:

enter image description here

It's applied to a selection which contains also some black as you did in your own attempt.

I do not have now GIMP. No idea if its colorize does the same.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.