Page 1 of 1

Transparency level for image

Posted: 2010-12-27T09:44:02-07:00
by KaGeUa
I think that it must me very easy but I can`t find option to make transparency for the image

I`m currently have code
convert image.jpg -colorize 100,0,0 image2.jpg

What should I add here to get image2.jpg with 0.7 transparency

Thanks in advance

Re: Transparency level for image

Posted: 2010-12-27T11:00:21-07:00
by fmw42
KaGeUa wrote:I think that it must me very easy but I can`t find option to make transparency for the image

I`m currently have code
convert image.jpg -colorize 100,0,0 image2.jpg

What should I add here to get image2.jpg with 0.7 transparency

Thanks in advance

I am not sure what you are doing, but your use of -colorize is just selecting the red channel and turning the green and blue channels to black. If you want to colorize an image (mix in some color) then typically you would use -fill somecolor -colorize XX%. That would mix in somecolor by XX% to all channels.

Nevertheless if you want to set the transparency to some constant value across the image, you can use

convert image -alpha set -channel A -evaluate set 30% result

to get a 70% transparent image. See http://www.imagemagick.org/Usage/canvas/#other


If you just want to create a color image with some transparency, then

convert -size WxH xc:"rgba(R,G,B,A)" result


If you have a binary image, you can set the transparency with -alpha copy. see http://www.imagemagick.org/Usage/basics/#alpha


Perhaps you can explain further what you want to do?

Re: Transparency level for image

Posted: 2010-12-28T22:59:08-07:00
by anthony
[quote="KaGeUa"
What should I add here to get image2.jpg with 0.7 transparency[/quote]

First -- JPEG can't save transparency!!!! You need to use some other format to save transparency like PNG.

Second just add a alpha channel and multiply it (or as JPEG are fully opaque you can just set it too.

Code: Select all

  convert image.jpg -alpha set -channel A -evaluate multiply 0.7 +channel   image_semitransparent.png