Resize height command operating on wrong axis

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
geno11x11
Posts: 3
Joined: 2019-09-10T22:50:03-07:00
Authentication code: 1152

Resize height command operating on wrong axis

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

Re: Resize height command operating on wrong axis

Post 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^.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Resize height command operating on wrong axis

Post 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
snibgo's IM pages: im.snibgo.com
Post Reply