Incoherent results related to -auto-orient for the same input file

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
abaudoux
Posts: 2
Joined: 2018-06-05T07:47:13-07:00
Authentication code: 1152

Incoherent results related to -auto-orient for the same input file

Post by abaudoux »

Hello,

I have (what I think are) incohérent results for the same input file when I use -auto-orient:
The following command:

Code: Select all

convert -define registry:temporary-path=/tmp/ -limit memory 8GiB -auto-orient \( -size 1686x3000 -resize 843x1500 tile:pattern:checkerboard -brightness-contrast 40.0 \) \( -density 95 /tmp/orientation.jpg[0] -resize 843x1500! -gravity center -background white -extent 843x1500  \)  -set units PixelsPerInch -density 72 -quality 80.0 -layers flatten -strip /tmp/out.jpg
does not auto-orient the image properly. When I remove the "checkerboard" part it does : The command

Code: Select all

convert -define registry:temporary-path=/tmp/ -limit memory 8GiB -auto-orient  \( -density 95 /tmp/orientation.jpg[0] -resize 843x1500! -gravity center -background white -extent 843x1500  \)  -set units PixelsPerInch -density 72 -quality 80.0 -layers flatten -strip /tmp/out.jpg
Does orient the image properly.

Source image (jpg file):

https://taktik.media/FwHI2jFF2q

Can you explain me why the addition of the checkerboard part cancels the auto-orient, and how to fix the problem? Thanks in advance!
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Incoherent results related to -auto-orient for the same input file

Post by snibgo »

What version of IM? On what platform?

Your commands are badly formed. You haven't read an image before you "-auto-orient", so what do you expect that command to do?

Similarly, you have a "-resize" before reading the checkerboard image, so what do you expect the "-resize" to do?

Commands should be in the logical order eg read an image, process it, write it. Or read in an image and process it, read another and process it, composite them together, then write the output.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Incoherent results related to -auto-orient for the same input file

Post by fmw42 »

Put -auto-orient into the parentheses that holds your input image.
abaudoux
Posts: 2
Joined: 2018-06-05T07:47:13-07:00
Authentication code: 1152

Re: Incoherent results related to -auto-orient for the same input file

Post by abaudoux »

I have the latest brew build for MacOs:

Version: ImageMagick 7.0.7-38 Q16 x86_64 2018-06-02 https://www.imagemagick.org
Copyright: © 1999-2018 ImageMagick Studio LLC
License: https://www.imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules
Delegates (built-in): bzlib freetype jng jpeg ltdl lzma png tiff xml zlib

Putting -auto-orient into the parentheses that holds the input image seems to solve the issue.

Thank you for your help
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Incoherent results related to -auto-orient for the same input file

Post by fmw42 »

As snibgo said, you have some syntax errors. IM 6 is forgiving, but not IM 7. So you should learn to use the proper syntax structure. Read the input, then follow with settings, then follow that with operators. Parenthesis typically isolate processing. So put settings and operators inside the parentheses if you want them to act on the images in the parentheses.
Post Reply