Main Menu

Normalize image orientation

Started by georgi.stoychev, June 27, 2024, 04:30:39 AM

Previous topic - Next topic

georgi.stoychev

Hello all,

So basically, I am facing the following issue:

I have a folder with 200+ photos, and some of them have the Orientation tag set as "Rotate 90 CW", and some of them have other values. What I would like to achieve is to somehow "normalize" them, so that they are always positioned correctly, and not rotated clockwise or mirrored. If I set the Orientation tag like so -orientation=, the image is immediately rotated sideways. If I set the orientation to Normal, the result is the same. I am trying to set this in Windows if it does matter.
Any help would be appreciated, and I can also provide more information if needed.

StarGeek

Images directly from a camera are always saved as landscape/horizontal images, i.e. they are wider than they are tall.  You can see this by looking at the ImageSize or ImageHeight/ImageWidth tags that exiftool reports. The Orientation tag is there to indicate how the image must be rotated in order to be displayed correctly.

To "Normalize" the images, you would have to actually directly rotate the image data. This is not something exiftool can do, as it only edits metadata, not image data.

Rotating a JPEG image can be done losslessly most of the time, but it takes special code to do so.  Otherwise, if you load/rotate/save an image in an editing program such as GIMP/Photoshop, it is a destructive operation, meaning that you are losing image data each time you resave it and this leads to "More JPEG". You need to use a program that says it does "lossless" JPEG rotation. On Windows, this can be done using XNView (see Image Rotation) or IrfanView, though you need to install the JPG_TRANSFORM plugin to do so.

As I said, this can be done most of the time, but not always. The dimensions must be divisible by 8 (or 16 sometimes).  For example, the photos from my cheap Samsung phone are 4080x3060 pixels.  And 3060 is not evenly divisible by 8 (3060/8=382.5).  That means if I rotate an image, I will lose 4 pixels off of one side.

But, when it comes down to it, why do you think you have to do this? These days, nearly all programs that read JPEGs will read the Orientation and properly rotate it when displaying or editing. Unless you're using some program that doesn't do so, there really isn't a need to rotate images.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).