Post Reply 

changing only specific colors

Apr 5, 2012, 16:16 (This post was last modified: Apr 5, 2012 16:19 by kevin32.)
Post: #1
changing only specific colors
Hi. I want to select a specific color from within the image, and change all similar colors within that image to a different color. In other words, after using the Color Picker Tool to select a color from the image, I want to take the selected color (and everything in the image that is equal to or similar in color), and change them all to a different color.

I tried using the Path's Tool to create an outline in the image, and changing colors that way, but it changes all the other colors in the selection I don't want to change. I just want to change all colors in the image/selection that are equal to or similar to the selected color. How do I do this? Thanks.
Find all posts by this user
Quote this message in a reply
Apr 5, 2012, 19:19
Post: #2
RE: changing only specific colors
It all depends how "specific" you want to be. I see at least three methods:

Color selection:
1) Use the color selection tool (not the color picker).
2) adjust threshold (0: very specific)
3) Click on a pixel of the right color, this will select all the pixels of the same color (within threshold)
4) bucket-fill selection with new color

Color transparency:
1) Make sure the layer has an alpha channel
2) Using "Colors/color-to-alpha", make transparent pixels of the replaced color (those for close colors will become partially transparent)
3) insert a new layer below
4) bucket fill layer with the replacement color

Color rotation:
1) Start Colors/Map/Rotate colors
2) use the "From" angle to indicate your source color range
3) use the "To" angle to indicate the target color range

The first method is the most obvious but the more likely to not give the expected results.

Now answering your questions on
https://Gimp-Forum.net
Visit this user's website Find all posts by this user
Quote this message in a reply
Apr 6, 2012, 09:22 (This post was last modified: Apr 6, 2012 09:59 by kevin32.)
Post: #3
RE: changing only specific colors
Which option would you consider gives a more 'natural' appearance? For example, I'm changing hair color, but in a way that certain colors in the hair should be consistent with the desired color. In other words, If most of the hair is natually colored black, but there are some grey areas in the hair, I want to change those grey areas to black so that it appears consistent/natural. Again, in my experience, changing colors using the path's tool gives an unnatural appearance.
Find all posts by this user
Quote this message in a reply
Apr 6, 2012, 09:53
Post: #4
RE: changing only specific colors
I'd try the rotation first. Do a rough selection around the hair (freehand selection) to limit the color rotation to the hair area (otherwise some random pixels can change elsewhere).

Now answering your questions on
https://Gimp-Forum.net
Visit this user's website Find all posts by this user
Quote this message in a reply
Apr 6, 2012, 14:54 (This post was last modified: Apr 6, 2012 14:55 by kevin32.)
Post: #5
RE: changing only specific colors
Is there an option within Rotate Colors, that makes the selection appear gray or darker (black)? Looks like it only changes to all colors other than these. Even 'Grey Options' only changes the greys to another color. (I think I was still editing my previous post at the time you last replied).
Find all posts by this user
Quote this message in a reply
Apr 6, 2012, 16:21
Post: #6
RE: changing only specific colors
What kind of target color are you aiming at? All gray? if so you only want to "desaturate" the colors... the technique would be somewhat different, but it depends a bit what you want to desaturate that way and how much darker you want the result. Can you post your original picture (or at least an extract) or give a URL to it?

Now answering your questions on
https://Gimp-Forum.net
Visit this user's website Find all posts by this user
Quote this message in a reply
Apr 9, 2012, 14:11 (This post was last modified: Apr 9, 2012 14:47 by kevin32.)
Post: #7
RE: changing only specific colors
http://postimage.org/image/6jecch9gb/

The goal is to change the grey hair colors to black but giving it a natural look.
Find all posts by this user
Quote this message in a reply
Apr 9, 2012, 16:18
Post: #8
RE: changing only specific colors
Hmm, that's changing an absence of color to another absence of color...

My best shot;
- Use the color picker to sample the cat's color (forehead) and set the foregoround color
- Duplicate the red channel and invert it (red background becomes black)
- Use the Levels tools on that channel to increase contrast
- Use the freehand too to select around the head and the tails (that are black enough)
- Feather the selection by 20-30px
- Save that selection to channel (in my example below i have two separate selections)
- Set the enhanced red channel to selection
- Subtract the head/tail channel from selection
- Add new layer
- bucket fill layer with foreground color

[attachment=1072]

(XCF also attached with layers/selections)

Now answering your questions on
https://Gimp-Forum.net
Visit this user's website Find all posts by this user
Quote this message in a reply
Apr 9, 2012, 20:06
Post: #9
RE: changing only specific colors
Thank you for the tips.
Find all posts by this user
Quote this message in a reply
Apr 10, 2012, 11:30
Post: #10
RE: changing only specific colors
Some of the tools and options you mention I haven't used before, so I have some questions:

> I duplicated the red channel, how do I invert it?

> When you say 'increase contrast', do I adjust the sliders on the 'input level' or the 'output level'?

> For the freehand tool, do you draw a general smooth line around objects where the colors are clearly distinct? or are you meticulous and drawing in the crevices of each hair, creating a jagged line?

> How do I save the selection to channel? I see some options in the channel settings, but nothing about 'saving' the selection to the channel.
Find all posts by this user
Quote this message in a reply
Apr 10, 2012, 12:48 (This post was last modified: Apr 10, 2012 12:50 by ofnuts.)
Post: #11
RE: changing only specific colors
(Apr 10, 2012 11:30)kevin32 Wrote:  Some of the tools and options you mention I haven't used before, so I have some questions:

> I duplicated the red channel, how do I invert it?
- Click on it, so that it gets the blue hilight
- Once this is done, the Tools you use will apply to that channel, and not to layers
- Use Colors/invert.
- Before you work again with layers, remember to select a layer

(Apr 10, 2012 11:30)kevin32 Wrote:  > When you say 'increase contrast', do I adjust the sliders on the 'input level' or the 'output level'?
Typically you move the handles on the source (top) inwards, so that everything above the white handle level becomes completely white, and everything below the black handle becomes completely black (this should in particular be the case of most the red background). But still keep some detail on the cat's body hair.

(Apr 10, 2012 11:30)kevin32 Wrote:  > For the freehand tool, do you draw a general smooth line around objects where the colors are clearly distinct? or are you meticulous and drawing in the crevices of each hair, creating a jagged line?
Just a general reasonably smooth line (we are going to feather it afterwards anyway)(by the way since you feather, give it an outward margin of the same amount as the feathering). Selecting hairs one by one like this is never done. In fact the purpose of creating a selection from the red channel is also to get a selection on the loose hairs automatically.

(Apr 10, 2012 11:30)kevin32 Wrote:  > How do I save the selection to channel? I see some options in the channel settings, but nothing about 'saving' the selection to the channel.
Select/Save to channel, what else: )

This case is a good exercise on channel management/editing...

Now answering your questions on
https://Gimp-Forum.net
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  best tutorial for changing someone's head to another body JaDan 19 9,106 Jul 20, 2017 05:07
Last Post: ythgilb
  Changing a silhouette to line art Tropdoug 3 343 Oct 7, 2014 07:51
Last Post: rich2005
Question Indexed palette of exact colors? chupo_cro 3 267 Sep 8, 2014 11:08
Last Post: chupo_cro
  Changing the color of a house with a new layer. sepoto 2 614 Sep 6, 2014 08:18
Last Post: janston
  How to set gradually changing opacity of a layer? adamail 2 346 Sep 4, 2014 07:30
Last Post: adamail

Forum Jump:


GIMP ForumPortalArchiveContactTermsRSS