Combining convert and composite commands execute as single command

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
richard_singh
Posts: 5
Joined: 2014-12-07T05:20:29-07:00
Authentication code: 6789

Combining convert and composite commands execute as single command

Post by richard_singh »

Hi,
I have requirement where I need to create lower resolution of image and then watermark image. Is that possible so that I convert higher res to lower res and watermark the lower res with composite command.

Regards,
Richard
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Combining convert and composite commands execute as single command

Post by fmw42 »

You will need to use convert ... -composite rather than composite to do multiple tasks in one command line. What version of IM and platform are you using? Is your watermark image grayscale or color?

see
http://www.imagemagick.org/Usage/compose/#watermark
http://www.imagemagick.org/Usage/compose/#dissolve

Please read viewtopic.php?f=1&t=9620
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Combining convert and composite commands execute as single command

Post by fmw42 »

try something like (unix syntax)

Code: Select all

convert \( backgroundimage -resize WxH \) watermarkimage \
-gravity South -compose dissolve -define compose:args=30,100 -composite \
resultimage
Specify the WxH for the resize. Modify the 30 value as desired for the strength of the watermark. And change South to wherever you want the watermark placed. You can add -geometry +X+Y to shift the watermarkimage relative to the gravity.
richard_singh
Posts: 5
Joined: 2014-12-07T05:20:29-07:00
Authentication code: 6789

Re: Combining convert and composite commands execute as single command

Post by richard_singh »

Thanks Fred. I was able to generate watermark image. I have quick question if the background image size is less than watermark image it generates image with partial content from the watermark file. Is there an option to provide so that watermark image re-size to background image.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Combining convert and composite commands execute as single command

Post by fmw42 »

I am not sure I understand what size you want the watermark image to be? Do you want it to be as large as the background or proportionally smaller than the background?
Post Reply