Page 1 of 1

how to convert height and width by percentage separately

Posted: 2017-01-11T18:03:27-07:00
by incendie22
So I have an a lot of images with different height and width. I want to resize the image by percentage, with height at a different percentage and width at a different percentage.

So an image of 200 x 100 pixel i want to convert it by 50% height and 30% width. how would I do that with imagemagick?

Re: how to convert height and width by percentage separately

Posted: 2017-01-11T20:01:20-07:00
by fmw42
I have moved this message here from Fred's Scripts, since it has nothing to do with my script.

Please always provide your IM version and platform, since syntax may vary.

Code: Select all

convert image -resize 50%x30% resultimage
If on IM 7 use "magick" rather than "convert"

If you want to process multiple images in one folder all at one time, then use mogrify or magick mogrify. See http://www.imagemagick.org/Usage/basics/#mogrify

Re: how to convert height and width by percentage separately

Posted: 2017-01-11T22:08:24-07:00
by incendie22
doesn't work. the result image is 50x25. it didn't even register the 30% width.

Re: how to convert height and width by percentage separately

Posted: 2017-01-11T22:54:56-07:00
by snibgo
You should tell us the IM version you are using, and the platform.

For example, if your code is in a Windows BAT file, "%" has a special meaning (about script parameters). When you don't want that special meaning, you need to double them:

Code: Select all

50%%x30%%

Re: how to convert height and width by percentage separately

Posted: 2017-01-11T23:08:20-07:00
by fmw42
What was your exact command line and your IM version and platform? As I said above, syntax may differ. Did you enter your image in the command as imagename.suffix?

What do you get from

Code: Select all

convert -version
That will tell us your IM version and your delegates.

Re: how to convert height and width by percentage separately

Posted: 2017-01-11T23:13:34-07:00
by incendie22
Double %% works. Thank you very much.