I'm running ImageMagick 6.9.9-26 Q16 x86_64 2018-03-27 on MacOS installed via MacPorts.
Doing "convert 2018-04-11-0001.jpg -resize 172x172" on the attached image (960x1280) results in an image that's resulted 90° (172x129, should be 129x172).
Any obvious reason that this is happening?
ImageMagick convert rotates images during resize
ImageMagick convert rotates images during resize
Last edited by Stubb on 2018-04-22T11:44:27-07:00, edited 1 time in total.
Re: ImageMagick convert rotates images during resize
It is never good to have - in an image name. I always use _ instead.
Try enclosing your image in " " e.g. convert "2018-04-11-0001.jpg" -resize 172x172
Try enclosing your image in " " e.g. convert "2018-04-11-0001.jpg" -resize 172x172
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: ImageMagick convert rotates images during resize
The input image is 960x1280, and the result of the resize (with IM v6.9.5-3) is 129x172. However, both images contain metadata "Orientation: 6", which tells viewers to rotate the image by 90 degrees.
The camera was held vertically to take the photo, and metadata correctly recorded this. Then some software rotated the image to make it vertical but without also changing the metadata, so some viewers will rotate it again.
A workaround is to correct the metadata:
The camera was held vertically to take the photo, and metadata correctly recorded this. Then some software rotated the image to make it vertical but without also changing the metadata, so some viewers will rotate it again.
A workaround is to correct the metadata:
Code: Select all
exiftool -n -Orientation=0 abcd.jpg
snibgo's IM pages: im.snibgo.com
Re: ImageMagick convert rotates images during resize
Very interesting. I'm tracing the image through my workflow (Photo Supreme for cataloging, DxO Photolab for editing) to see where the problem occurs…
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: ImageMagick convert rotates images during resize
try adding -auto-orient to your command
Code: Select all
convert -auto-orient 2018-04-11-0001.jpg -resize 172x172" ...
Re: ImageMagick convert rotates images during resize
That doesn't seem to do the trick.fmw42 wrote: ↑2018-04-22T14:33:01-07:00 try adding -auto-orient to your command
Code: Select all
convert -auto-orient 2018-04-11-0001.jpg -resize 172x172" ...
I've presently added a post-resize command to my script:
Code: Select all
exiftool -P -overwrite_original_in_place -Orientation=0 -n <thumbnail file>