Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImageMagick reorients iOS photos

I am currently converting images coming from mobiles apps, i.e. iOS, Android and WP.

I use image magick to resize the photos.

Here is my command line:

convert -resize 764x764 -strip -interlace Plane -quality 85% img1.jpg img2.jpg

It works fine for photos coming from Android and WP however, when I receive it from iOS, the photos are automatically rotated to landscape, even if they are portraits.

Any ideas?

Thank you.

like image 996
6MarViN Avatar asked Oct 15 '25 08:10

6MarViN


1 Answers

Photo orientation can be defined by the images meta-data. Add the -auto-orient option to respect the EXIF data before removing it with -strip options.

convert img1.jpg -auto-orient \
        -resize 764x764 \
        -interlace Plane \
        -strip \
        -quality 85% \
        img2.jpg

Warning from docs:

If the EXIF profile was previously stripped, the -auto-orient operator will do nothing.

like image 75
emcconville Avatar answered Oct 16 '25 21:10

emcconville



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!