turtle
turtle

Reputation: 8083

Selectively rotate vertical images

I have a directory of images, some of which are vertical (height x width) 7 x 5 while others are horizontal 5 x 7. I'd like to use imagemagick (or other tool) to rotate only the verical images to horizontal. Is this possible to do with imagemagick?

Upvotes: 4

Views: 2279

Answers (1)

Cobra_Fast
Cobra_Fast

Reputation: 16061

As per http://www.imagemagick.org/script/command-line-options.php#rotate, you can conditionally rotate images:

convert input.jpg -rotate "90<" output.jpg

This will only rotate, clockwise by 90 degrees, if the height exceeds the width (what you described as a "vertical" image, widely known as portrait orientation).

Upvotes: 10

Related Questions