Page 1 of 1

Re: Need help in creating a tranparency border

Posted: 2007-10-14T05:13:43-07:00
by sevasjack
You can make border and fill it with semitransparency (-fill '#CCCCCC80' -opaque '#CCCCCC') like on the page
http://imagemagick.org/Usage/bugs/trans_bug/
and then conposite images
or you can use something like that

Code: Select all

convert test.jpg -matte -channel A -fx 0.5 test2.png

Re: Need help in creating a tranparency border

Posted: 2007-10-14T08:25:30-07:00
by Bonzo
There is probably a better way to do this:

Code: Select all

convert -size 400x300 xc:blue blue_square.png

convert -size 400x300 xc:none -draw " fill black rectangle 50,50 350,250 " black_square.png

composite -compose Dst_Out black_square.png -gravity center blue_square.png -matte result_border.png 

composite -blend 88 -gravity center result_border.png sunflower.jpg -matte blue.jpg
First convert creates the background colour to be used in the border in this case blue
Second convert creates a mask which will be used to create the transparent area in the middle
First composite cuts the square out of the blue background leaving the blue border
Second coposite puts the border on top of the image changing its opacity

You need to cleanup and remove the tempory images