How do I batch resize images with different orientations?

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
jweinraub
Posts: 2
Joined: 2017-01-20T10:45:44-07:00
Authentication code: 1151

How do I batch resize images with different orientations?

Post by jweinraub »

I have a huge folder of images in a variety of orientations and resolutions that I would like to all be processed since i want them to be all 4x6 or 6x4 and cropped to fit that size if can't to keep the aspect ratio clean and not stretched but i am unsure how to determine orientation so globally making it all one size won't work and since resolutions are all different, changing percent won't work either. if at all possible as well, can they be cleaned like autolevels/autocurves that photoshop does per chance?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How do I batch resize images with different orientations?

Post by fmw42 »

I am not sure I understand your problem with orientations and aspect. Can you provide some example images to show the issue and explain further. Imagemagick mogrify will be able to apply -auto-level or -contrast-stretch to all images in any one folder.

If you images have EXIF data, then there may be a stored orientation and so you can use the IM command -auto-orient to handle correcting the orientation.

You can post images to any free hosting service such as dropbox.com and put the URLS here.

Also please always provide your IM version and OS/platform.
jweinraub
Posts: 2
Joined: 2017-01-20T10:45:44-07:00
Authentication code: 1151

Re: How do I batch resize images with different orientations?

Post by jweinraub »

I am using

Version: ImageMagick 6.8.9-9 Q16 x86_64 2016-08-25 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC Modules OpenMP
Delegates: bzlib cairo djvu fftw fontconfig freetype jbig jng jpeg lcms lqr ltdl lzma openexr pangocairo png rsvg tiff wmf x xml zlib

I have two pictures say, one was taken portrait one was taken landscape, I want to simply resize them to 4x6" or 6x4" depending on its orientation.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How do I batch resize images with different orientations?

Post by fmw42 »

Do they both already have 4:6 or 6:4 aspect ratio? If not, then you need to decide whether your want 1) to resize with distortion, 2) resize and crop or 3) resize and pad. Is the image already the correct size in one dimension?

Please provide an example image and explain what you need done to it in terms of new dimension.

See
http://www.imagemagick.org/script/comma ... p#geometry
http://www.imagemagick.org/Usage/resize/#resize
http://www.imagemagick.org/Usage/thumbnails/#fit
http://www.imagemagick.org/Usage/thumbnails/#pad
http://www.imagemagick.org/Usage/thumbnails/#cut

User -resize rather than -thumbnail if you want to keep meta data.
Post Reply