17

How to add padding when using imagemagick to convert an EPS into a PNG?

I want to do something like:

convert logo.eps -size 128x128 logo.png

But want the actual logo to be 96x96px, centered, surrounded by a transparent background to reach 128x128 pixels.

palacsint
  • 28,416
  • 10
  • 82
  • 109
user1680104
  • 8,437
  • 4
  • 22
  • 27

1 Answers1

32

found it out myself:

convert logo.eps -background transparent -gravity center -scale 96x96 -extent 128x128 logo.png
user1680104
  • 8,437
  • 4
  • 22
  • 27
  • 3
    It works, thanks. Do you know how to keep the background to be transparent inside the inner image 96x96? Currently the image background is white. I would also like to change the color and alpha of the image to #99333333 value to achieve Android Holo Light icon recommendation: http://developer.android.com/design/style/iconography.html. Do you know how to achieve that? Thanks. – petrsyn Mar 21 '14 at 01:02
  • 2
    @petrsyn I found using `-background none` (instead of `-background transparent`) *before* the input file name did the trick. – chris Dec 31 '15 at 09:31