How to change to a specific color by its hex code in GIMP?

7

4

I have a simple black vector icon, and I want to change its color to an other color. I have this other color in hex.

I can use colorize but I can't achieve this color I have in hex.

How can I do it in GIMP?

woyaru

Posted 2011-10-14T10:33:51.433

Reputation: 173

Answers

8

Sounds like you have not a black icon but a grayscale icon. If your icon is nothing but black, gray (edges), and white background, then you can colorize it quite simply. First, convert your hex color to HSL color. Second, choose the Colorize tool and plug in your H, S, and L.

Converting from hex color to HSL color is pretty straightforward arithmetic but it is even easier to use an online converter (for example, http://serennu.com/colour/hsltorgb.php). Just be careful not to convert to HSV by mistake, because that is a different color system with a very similar name.

For example: Puce #cc8899 converts to H=345°, S=40%, L=67%. Plug 345, 40, and 67 into Colorize.

MetaEd

Posted 2011-10-14T10:33:51.433

Reputation: 309

Thank you. This is very helpful. But I have small problem. As I have noticed I have my icon in black color. And I want to achieve it in color: 3B3737 HEX; 59,55,55 RGB. So I do everything like you have described, and I have achieved color 3A3535 HEX. This is very similiar to 3B3737 HEX. I am wondering how can I achieve exactly the color I want. – woyaru – 2011-10-22T16:18:46.290

1Yes, the conversion from RGB to HSL and back to RGB can be imperfect because fractional values are truncated. Since you need an exact RGB match, I suggest an added step after the colorize. Because this is a less than 1% color correction, I assume it will not be necessary to correct the edges, just the main body of the icon. To color correct the 3A3535 pixels to 3B3737, load your paint bucket with 3B3737, select the bucket fill parameter "fill similar colors", set threshold to 0, and click in the area to be corrected. – MetaEd – 2011-10-24T14:58:40.190

3

In gimp, click on the foreground color box in the toolbox to bring up the Change Foreground Color dialog. In this dialog, enter your hex value in the box to the right of the label HTML_notation and click OK. That will change the foreground color to your hex value.

Use the bucket fill tool to change the black portions of your icon to the foreground color.

Icon files can have multiple layers with different resolutions. Be sure you are editing a visible layer. You will have to change all layers (or just edit the highest resolution and then recreate the other layers using this method.)

W_Whalley

Posted 2011-10-14T10:33:51.433

Reputation: 3 212

Thank you for reply. I know this method. :) When I do all with your solution in my icon I lose transparent edges in my icon. So it isn't good solution for me. – woyaru – 2011-10-14T22:26:24.637

what do you mean you lose the transparent edges? Does the icon then have a border? an image on this question would help. – Ele Munjeli – 2011-10-15T18:11:47.727

Icon doesn't have a border, but the figure in the icon has semitransparent color on its edges. I can't upload image because it isn't freeware icon. – woyaru – 2011-10-16T13:32:12.450

From what you are saying, it isn't a single colour, but has a transparent gradient at the edges. How about doing a select by colour and feathering the edges of the selection? – Paul – 2011-10-18T01:42:35.487