I'm searching for a way to match colors using ImageMagick.
Let's say I'v got those samples here:
What I would like to do is get the faces on those photos as close in both color and luminance to the sample skin_tone below:
I'v tried composing them with the skin tone using threshold blend mode as well as the colorize one, but both give results that I just can't use.
I'v gone so far as to put the skin_tone onto the samples with colorize, then making a difference mask using the colorized sample and the skin_tone image and then using that with CopyOpacity from the oryginal sample to get just the parts on the image (eyes and nose and mouth), but I would still like to be able to match the colors using the skin_tone.jpg to get something like this:
any ideas?
Match colors.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Match colors.
try either
# get average skin tone and colorize a grayscale image using +level-colors
color=`convert skin_tone.jpg -scale 1x1! -format "%[pixel:s.p{0,0}]" info:`
convert sample_2.jpg -colorspace gray +level-colors black,$color sample_2_skin_A.jpg
or
# composite the two images
convert skin_tone.jpg \( sample_2.jpg -colorspace gray \) -compose multiply -composite sample_2_skin_C.jpg
You can use -modulate to brighten it a little also, or change the saturation or hue
convert sample_2_skin_A.jpg -modulate 110,100,100 sample_2_skin_A_b110.jpg
see http://www.imagemagick.org/script/comma ... p#modulate
# get average skin tone and colorize a grayscale image using +level-colors
color=`convert skin_tone.jpg -scale 1x1! -format "%[pixel:s.p{0,0}]" info:`
convert sample_2.jpg -colorspace gray +level-colors black,$color sample_2_skin_A.jpg
or
# composite the two images
convert skin_tone.jpg \( sample_2.jpg -colorspace gray \) -compose multiply -composite sample_2_skin_C.jpg
You can use -modulate to brighten it a little also, or change the saturation or hue
convert sample_2_skin_A.jpg -modulate 110,100,100 sample_2_skin_A_b110.jpg
see http://www.imagemagick.org/script/comma ... p#modulate
Re: Match colors.
Ah yes, thanks for the reply. I'v tried those previosly, but what I want to do is match the overal lightness and hue and saturation.. not loosing the color of the eyes or mouth.
I'm up to something so when I'll finish I'll post it here.
I'm up to something so when I'll finish I'll post it here.