combining two convert commands into one

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
kannaiah
Posts: 2
Joined: 2016-05-14T12:47:37-07:00
Authentication code: 1151

combining two convert commands into one

Post by kannaiah »

Hi,

I'm trying to use merge few images, I'm able to get the image I want with two commands but unable to do it in a single command.

Code: Select all

convert background.png -level 0%,100%,0.6 -blur 2x8 fore_01.png -gravity center -composite temp.png
convert temp.png fore_02.png -geometry +715+313 -composite fore_03.png -geometry +566+575 -composite result.png
Is there a way to get the same result in one command.

I tried to follow few tutorials but unble get upto speed. If there is a simple nice tutorial please let me know.

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

Re: combining two convert commands into one

Post by fmw42 »

What version of Imagemagick and what platform? Please always provide that information.

Reset your -gravity before the next composite, unless your geometry coordinates are center relative and not upper left relative. I have done it here twice, thought only one time is really needed.

Unix syntax:

Code: Select all

convert \( background.png -level 0%,100%,0.6 -blur 2x8 \) \
fore_01.png -gravity center -composite \
fore_02.png -gravity northwest -geometry +715+313 -composite \
fore_03.png -gravity northwest -geometry +566+575 -composite result.png
Windows syntax:

Code: Select all

convert ( background.png -level 0%,100%,0.6 -blur 2x8 ) ^
fore_01.png -gravity center -composite ^
fore_02.png -gravity northwest -geometry +715+313 -composite ^
fore_03.png -gravity northwest -geometry +566+575 -composite result.png
kannaiah
Posts: 2
Joined: 2016-05-14T12:47:37-07:00
Authentication code: 1151

Re: combining two convert commands into one

Post by kannaiah »

Thank you very much.
It worked.

will remember to put all the details next time.
Post Reply