You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have in input a picture which is reported by exiftool as:
Image Size: 4208x3120
Orientation: Mirror horizontal and rotate 270 CW
This means that it was taken with a front camera (so the mirror) and, due to the spatial orientation of the smartphone, it was shooted as landscape but in reality it is a portrait.
Using any random viewer, it is correctly handled and it is shown as a portrait image 3120x4208.
The goal is to resize the picture to a portrait of <768px> x <whatever_to_keep_aspect_ratio> but it cannot be done by using -auto-orient together with -resize.
See below.
Steps to Reproduce
This is the command line that I use and that, in general with different orientations, works fine:
As you can see, I'm using the -auto-orient option together with the -resize 768x so that I expect that the image is first mirrored and rotated to become portrait from landscape and, after that, I expect that the TOP side is 768px wide.
Unfortunately, it is the height that becomes 768 as if the original image was not rotated before the resizing, and to add to this I get a landscape image of 1036x768 with a right white vertical stripe and the bottom part cropped out. I tried by moving around the -resize and -auto-orient in various position before and after the input file in the command line, but always with different wrong results.
I can reach the goal by analyzing the orientation beforehand, removing the -auto-orient and setting the -resize to x768 instead of 768x, but this work should be done automatically by the -auto-orient option, not by me. Also the handling should be different depending on the orientation metadata inside the image file.
Am I doing anything wrong in the command line or is it a real bug?
Images
This is the original image:
This the resized one:
The text was updated successfully, but these errors were encountered:
You have IM v7, but use the convert command, which uses the old v6 syntax. One problem with the v6 syntax is that operations were not necessarily executed in the order you specify.
You rely on v6 doing operations out of order, because you have "-antialias -background 'white' -flatten -auto-orient" before reading the input. With v7 syntax, this is not permitted: we can't -flatten or -auto-orient an image before we have read the image.
Instead, I suggest using the magick command. This will execute operations in the order you specify.
This works fine for me, with IM v7.1.1-20, where topLeftIn.jpg is your input file:
magick topLeftIn.jpg -antialias -background white -flatten -auto-orient -resize 768x out.png
ImageMagick version
7.1.1-29
Operating system
Linux
Operating system, version and so on
openSUSE Leap v15.5
Description
I have in input a picture which is reported by exiftool as:
Image Size: 4208x3120
Orientation: Mirror horizontal and rotate 270 CW
This means that it was taken with a front camera (so the mirror) and, due to the spatial orientation of the smartphone, it was shooted as landscape but in reality it is a portrait.
Using any random viewer, it is correctly handled and it is shown as a portrait image 3120x4208.
The goal is to resize the picture to a portrait of <768px> x <whatever_to_keep_aspect_ratio> but it cannot be done by using
-auto-orient
together with-resize
.See below.
Steps to Reproduce
This is the command line that I use and that, in general with different orientations, works fine:
convert -limit disk 100GiB -limit map 24GiB -limit memory 38GiB -limit area 38GB -limit time 14699 -limit thread 4 -density 72 -antialias -background 'white' -flatten -auto-orient 'mirrored_and_rotated_270_CW-original.jpg' -alpha 'remove' -resize '768x' -quality '85' -antialias -verbose -version 'mirrored_and_rotated_270_CW-resized.jpg' 2>&1
As you can see, I'm using the
-auto-orient
option together with the-resize 768x
so that I expect that the image is first mirrored and rotated to become portrait from landscape and, after that, I expect that the TOP side is 768px wide.Unfortunately, it is the height that becomes 768 as if the original image was not rotated before the resizing, and to add to this I get a landscape image of 1036x768 with a right white vertical stripe and the bottom part cropped out. I tried by moving around the
-resize
and-auto-orient
in various position before and after the input file in the command line, but always with different wrong results.I can reach the goal by analyzing the orientation beforehand, removing the
-auto-orient
and setting the-resize
tox768
instead of768x
, but this work should be done automatically by the-auto-orient
option, not by me. Also the handling should be different depending on the orientation metadata inside the image file.Am I doing anything wrong in the command line or is it a real bug?
Images
This is the original image:
This the resized one:
The text was updated successfully, but these errors were encountered: