help resizing a transparent png

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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: help resizing a transparent png

Post by fmw42 »

Interesting that I don't see -size in the options page at http://www.imagemagick.org/script/comma ... ptions.php

If you want to add a border, use either -extent or -border. see http://www.imagemagick.org/script/comma ... ptions.php

But your command is needlessly complicated. I would do it this way

convert mypng.png -resize 480x270\> -gravity center -background none -extent 480x270 resized.png
Last edited by fmw42 on 2009-04-23T09:29:30-07:00, edited 1 time in total.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: help resizing a transparent png

Post by anthony »

the -size option specifies the size of an image to generate (xc: gradient: plasma: label: etc) or hint at what the final size will be for JPEG.

That last can cause problems if reading in images later afetr creating a canvas image of some kind. It may be a good idea to turn off the size setting (using +size) if you plan to read in other images later. This has caught me out on occasion.

It would be nice in the JPEG size hint was a separate coder setting (typically a -define option) instead of -size
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply