Page 1 of 1

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

Posted: 2018-06-05T08:08:44-07:00
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!

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

Posted: 2018-06-05T08:30:01-07:00
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.

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

Posted: 2018-06-05T08:31:30-07:00
by fmw42
Put -auto-orient into the parentheses that holds your input image.

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

Posted: 2018-06-05T08:56:45-07:00
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

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

Posted: 2018-06-05T09:08:53-07:00
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.