noob problem combining two commands

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
hyppy

noob problem combining two commands

Post by hyppy »

Hi, I'm struggling to combine two commands into one, and wonder if someone could help me out ...

Based on samples found on the site, I'm able to reflect a source image, and then merge that with another image to act as a background. I'm having to first create the reflected image using ...

Code: Select all

convert source.png -adaptive-resize 277x350! -alpha on  -virtual-pixel transparent -filter point \
      \( +clone -flip  \
	-size 277x80 gradient:gray30-black\
	 alpha off -compose CopyOpacity -composite \
	\) -append \
     +distort Perspective '0,0 37,43 0,277 37,212 277,350 199,281 350,0 259,18' \
     -gravity North  -crop 277x350+53-0\! \
     -background transparent -compose Over -flatten generated.png
and then merge it with ...

Code: Select all

composite generated.png background.png output.png
I'm sure that doing some nesting using \( ... \) I ought to be able to make it all happen in one go, but have no luck in trying to work out how myself.

Thanks in advance for any guidance or suggestions.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: noob problem combining two commands

Post by Bonzo »

It would be a good idea to post your images and the output you expect along with your version.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: noob problem combining two commands

Post by fmw42 »

you can composite with convert rather than composite. so you can have one convert command.

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

convert source.png -adaptive-resize 277x350! -alpha on -virtual-pixel transparent -filter point \
\( +clone -flip \
-size 277x80 gradient:gray30-black\
alpha off -compose CopyOpacity -composite \
\) -append \
+distort Perspective '0,0 37,43 0,277 37,212 277,350 199,281 350,0 259,18' \
-gravity North -crop 277x350+53-0\! \
-background transparent -compose Over -flatten \
background.png +swap -composite output.png
hyppy

Re: noob problem combining two commands

Post by hyppy »

Perfect, fmw42—a solution, and something else learned :D
Post Reply