Page 1 of 1

convert white shades in grayscale image transparent

Posted: 2014-08-30T17:40:39-07:00
by ravikum
Hi,
I have a grayscale passport size photo of a person.
How to convert all the white shades in that transparent, and keep the black color not transparent.

I have tried the command

Code: Select all

convert 1.png -background black -alpha copy -type truecolormatte PNG32:1_alpha.png
from this page viewtopic.php?f=1&t=17526#p65952
but it seems to do the opposite.

Please help.
Thanks

Re: convert white shades in grayscale image transparent

Posted: 2014-08-30T17:50:10-07:00
by fmw42
This request is not really very clear.

Is your image black and white or gray? Do you want to preserve the pure black and make the rest of the grays transparent or do you want to make pure white transparent and leave the rest as is?

Perhaps you should post your image to some free hosting service such as dropbox.com and put the URL here.

This works fine for me on IM 6.8.9.7 Q16 Mac OSX with a grayscale image.

Code: Select all

convert image.png -alpha copy PNG32:result.png

Re: convert white shades in grayscale image transparent

Posted: 2014-08-30T18:44:34-07:00
by ravikum
Thanks.
The code above is working for me.