0

I have a 70px x 70px image logo. I want to make a 170px X 70px transparent image and append the logo in the center of this. How can this be achieved with the ImageMagick command line tool convert.exe?

Any help will be highly appreciated.

Thanks.

dda
  • 6,030
  • 2
  • 25
  • 34
WatsMyName
  • 4,240
  • 5
  • 42
  • 73
  • Have you read the ImageMagick manual? What have you tried? – dda Feb 19 '13 at 06:33
  • Yes I did, and i didnt find any proper way to do it, theyve said using `-append` will append two images, but didn't find any where to place the image exactly at the center of the rectangular transparent image. – WatsMyName Feb 19 '13 at 06:39

1 Answers1

2

I hope you do not mind me saying but you have missread the manual. Append is for joining two images side by side or one above the other; not one on top of another. The code below will work but if you want to do something more complicated you would need to use -composite.

convert logo.png -background none -gravity center -extent 170x70 output.png

Alternate method requested:

convert -size 170x70 xc:none logo.png -geometry +100+10 -composite output.png
Bonzo
  • 5,169
  • 1
  • 19
  • 27
  • Thanks for the reply, just like to ask, what if i don't want to position the logo at the center? what command should I use instead of `-gravity` ?? – WatsMyName Feb 22 '13 at 11:02
  • 1
    It depends where you want to position it. You can use compass points like northwest, west etc. instead of center. If you want to position it at a certain location you would need to use a different method. See added code above. – Bonzo Feb 22 '13 at 17:08