Page 1 of 1

how to increase black color in an photo?

Posted: 2014-08-25T16:04:40-07:00
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.

Re: how to increase black color in an photo?

Posted: 2014-08-25T17:08:01-07:00
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

Re: how to increase black color in an photo?

Posted: 2014-08-25T18:25:19-07:00
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

Re: how to increase black color in an photo?

Posted: 2014-08-25T18:54:20-07:00
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

Re: how to increase black color in an photo?

Posted: 2014-08-25T19:57:04-07:00
by ravikum
it worked. thanks