Page 1 of 1

Resize height command operating on wrong axis

Posted: 2019-09-29T19:20:34-07:00
by geno11x11
I need to reduce the height of all images in a directory to a maximum of 1080 pixels.

The command line: magick mogrify -resize x1080 *.jpg should have done just that. However, a number of files were left unmodified; their height pixels count at 1440.

After consulting the IM manual the command appeared to be correct. On a hunch, I thought perhaps the orientation was being confused by IM. I modified the command line to: magick mogrify -resize 1080 *.jpg. This command line should reduce the width however it succeeded in reducing the height of a previously unmodified portrait file from 1440 to 1080.

Please explain what is going on here. IM seems to be treating portrait oriented images as Landscape images.

Re: Resize height command operating on wrong axis

Posted: 2019-09-29T19:32:35-07:00
by fmw42
Your first command -resize x1080 should have worked. Please post an example image that failed. Perhaps it needs to be auto-oriented first.

Your second command will be the same as 1080x1080 and will resize the largest dimension to 1080 and the other in proportion. So if the image is portrait (w<h), it will work and scale the height, but if the image is landscape (w>h), it will scale to the width in place of the height.

If you need to scale to the smaller dimension add ^ to the end of the dimensions 1080x1080^.

Re: Resize height command operating on wrong axis

Posted: 2019-09-30T04:06:32-07:00
by snibgo
geno11x11 wrote:IM seems to be treating portrait oriented images as Landscape images.
Use "-auto-orient". See http://www.imagemagick.org/script/comma ... uto-orient