I have got a requirement to resize the JPEG, TIFF, EPS and PNG image formats as per their orientation and later convert them to JPEG. I want to know if there's a way using ImageMagick by which we can find if the orientation of the image is "landscape" or "portrait". As the requirement is to resize the height of the image in case of portrait images and to resize width in case of landscape ones. Currently I'm using the below code to do so:
For Portrait I'm changing the resolution to 2048px and pixel density to 72dpi as below.
Code: Select all
convert -units PixelsPerInch <input_file> -density 72 -resize x2048 <output_file.jpeg>
Code: Select all
convert -units PixelsPerInch <input_file> -density 72 -resize 2048 <output_file.jpeg>