Resizing image without stretching it, possible?

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
john86b
Posts: 5
Joined: 2011-02-21T13:28:59-07:00
Authentication code: 8675308

Resizing image without stretching it, possible?

Post by john86b »

This wonderful little software saved me about ten thousand hours of work, but now I need something I do not know whether it's possible.
I have these 40x40 png icons, but the elements inside it fit a 32x32 size PERFECTLY, how can I resize all my png icons and centralize the object?

Thanks!
john86b
Posts: 5
Joined: 2011-02-21T13:28:59-07:00
Authentication code: 8675308

Re: Resizing image without stretching it, possible?

Post by john86b »

Actually, I was thinking about it, this isn't a matter of resizing, it's more a matter of cropping out the left over space... from 40x40 to 32x32
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Resizing image without stretching it, possible?

Post by fmw42 »

can you post a link to an example icon and explain what the issue is. the command -resize will resize proportionally if that is what you mean (that is keeping the aspect ratio).

see
http://www.imagemagick.org/script/comma ... php#resize
http://www.imagemagick.org/script/comma ... p#geometry
http://www.imagemagick.org/Usage/resize/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Resizing image without stretching it, possible?

Post by fmw42 »

john86b wrote:Actually, I was thinking about it, this isn't a matter of resizing, it's more a matter of cropping out the left over space... from 40x40 to 32x32
Is the 32x32 always centered in the 40x40?

convert icon -gravity center -crop 32x32+0+0 +repage smallicon

see
http://www.imagemagick.org/Usage/crop/#crop
Post Reply