how to increase black color in an photo?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
ravikum
Posts: 34
Joined: 2013-03-20T05:35:37-07:00
Authentication code: 6789

how to increase black color in an photo?

Post by ravikum »

Hi,
I have this input :
Image

I have applied :

Code: Select all

convert input -fill '#FCB587'  -colorize 50% output
and the output :
Image

How to increase the black color of the output so that the hair, eyebrows, beard etc become darker without changing the skin color of the output?

I tried the -tint but the skin color is different than what I got in output.

Please suggest if I can achieve the skin color in output without changing the color of hair using any other commands.

Please suggest.
Thanks.
(using the latest IM version on linux centos 6)
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: how to increase black color in an photo?

Post by fmw42 »

try this. it makes a copy of the image and reduces the brightness via -modulate. then it converts a copy of the image to HSI and separates the channels. It thresholds the brightness and saturation to get low values of each and negates and multiplies the two to create a mask. The mask is then used to composite the two images. You can adjust the modulation (80) value and or the two thresholds (25%) to suit.

Code: Select all

convert s2goki.jpg \
\( -clone 0 -modulate 80,100,100 \) \
\( -clone 0 -colorspace HSI -separate +channel \) \
\( -clone 4 -threshold 25% -negate \) \
\( -clone 3 -threshold 25% -negate \) \
\( -clone 5 -clone 6 -compose multiply -composite \) \
-delete 2-6 -compose over -composite result.png
ravikum
Posts: 34
Joined: 2013-03-20T05:35:37-07:00
Authentication code: 6789

Re: how to increase black color in an photo?

Post by ravikum »

thanks for the reply.
But the result I got is almost the same as input.

Also, you have not used the fill color #FCB587 in your code.
I have to do this with many more photos with some hex fill color tint for each photo.

So, please suggest me how to darken the hair after tinting with the hex color.

Thanks
(using the latest IM version on linux centos 6)
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: how to increase black color in an photo?

Post by fmw42 »

ravikum wrote:thanks for the reply.
But the result I got is almost the same as input.

Also, you have not used the fill color #FCB587 in your code.
I have to do this with many more photos with some hex fill color tint for each photo.

So, please suggest me how to darken the hair after tinting with the hex color.

Thanks
I thought all you wanted was to darken the hair and leave the skin tones alone in the original. But you could do just tint and use the tinted image as input to my code.

So try the following with a higher threshold, since your tinted image is brighter. Change the modulate (80) or threshold as desired. You have to test different values yourself to suit.

convert s2goki.jpg -fill '#FCB587' -colorize 50% \
\( -clone 0 -modulate 80,100,100 \) \
\( -clone 0 -colorspace HSI -separate +channel \) \
\( -clone 4 -threshold 54% -negate \) \
\( -clone 3 -threshold 54% -negate \) \
\( -clone 5 -clone 6 -compose multiply -composite \) \
-delete 2-6 -compose over -composite result.png
ravikum
Posts: 34
Joined: 2013-03-20T05:35:37-07:00
Authentication code: 6789

Re: how to increase black color in an photo?

Post by ravikum »

it worked. thanks
(using the latest IM version on linux centos 6)
Post Reply