Page 1 of 1

The best way to add a PNG mask using convert?

Posted: 2007-03-02T05:44:31-07:00
by webunity
Right now i have this working code, to add a transparant image called "mask.png" to a "test.jpg" file:
convert -quality 70 -draw 'image Over 0,0 1024,768 "mask.png"' "test.jpg" jpg:"e4408a4e.jpg"

This command takes about 2 seconds to complete, and i think there must be a quicker way.

All i want to do, is "overlay" the mask onto the input picture. I've had faster results with using this command:
composite -compose plus "mask.png" "test.jpg" jpg:"e4408a4e.jpg"

But i also need to resize the input file, so i thought i'd do it in one call to convert.

Allready found the answer thanx to this page: http://www.imagemagick.org/Usage/thumbnails/
convert "test.jpg" -quality 70 "mask.png" -compose Over -composite jpg:"e4408a4e.jpg"

Re: The best way to add a PNG mask using convert?

Posted: 2007-03-04T17:44:39-07:00
by anthony
Good to see you using IM Examples.

You can however also resize and position the image in composite (and convert) using the -geometry operator. See
http://www.imagemagick.org/Usage/resize/#geometry