Resizing based on height alone

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
Drew.Yuschock
Posts: 2
Joined: 2015-05-13T15:17:02-07:00
Authentication code: 6789

Resizing based on height alone

Post by Drew.Yuschock »

Hey guys,

I'm doing some work batch converting svgs to pngs and as part of this, I would like to set a hard cap on the height of converted image while the width could vary.

Is this possible from command line or would I not be able to do so.

Right now I'm doing

Code: Select all

for /r %%v in (*.svg) do convert "%%v" "%%~nv.png"
But I'd like to say "I want the new height of the image to 600 and maintain that ratio with the width"

So that if an image is 100x100 its new size would be 600x600 and if an image is 100x200 its converted size would be 600x1200.

Thanks!

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

Re: Resizing based on height alone

Post by fmw42 »

try

Code: Select all

convert image -resize x600 result
see
http://www.imagemagick.org/script/comma ... p#geometry


Also mogrify can do a whole directory without your having to build a script to loop over images.

see
http://www.imagemagick.org/Usage/basics/#mogrify
Drew.Yuschock
Posts: 2
Joined: 2015-05-13T15:17:02-07:00
Authentication code: 6789

Re: Resizing based on height alone

Post by Drew.Yuschock »

Thanks!

I spent a little time looking at the resizing options but there were so many there.
Post Reply