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.
Resize height command operating on wrong axis
- 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
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^.
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^.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Resize height command operating on wrong axis
Use "-auto-orient". See http://www.imagemagick.org/script/comma ... uto-orientgeno11x11 wrote:IM seems to be treating portrait oriented images as Landscape images.
snibgo's IM pages: im.snibgo.com