Page 1 of 1

noob problem combining two commands

Posted: 2009-11-20T13:40:38-07:00
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.

Re: noob problem combining two commands

Posted: 2009-11-20T15:09:56-07:00
by Bonzo
It would be a good idea to post your images and the output you expect along with your version.

Re: noob problem combining two commands

Posted: 2009-11-20T16:23:43-07:00
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

Re: noob problem combining two commands

Posted: 2009-11-21T02:12:50-07:00
by hyppy
Perfect, fmw42—a solution, and something else learned :D