8

There are few applications, that I have installed on almost every Windows 7 computer. This are applications such as:

  • Windows Live Gallery (Windows Live Essentials)
  • Picasa
  • anything, that comes out of the box with Windows 7

Which of those applications is able to rotate, in batch, all of the pictures in one folder based on EXIF information?

I know there are lots of applications, that can do exactly this, but does any of standard applications do that? Sometimes I cannot install anything new, and I'm using several different computers in different places.

Let me repeat - I want to turn pictures based on EXIF info, not ALL of them.

5 Answers 5

4

jhead + jpegtrans

Use jhead (which requires jpegtran for the auto-rotation feature).

From the windows shell,

jhead.exe -autorot image.JPG

For a batch of pictures in a directory, use shell globbing, e.g.

jhead.exe -autorot pics\*.JPG`

jhead will not modify files that do not need rotation.


Additionally

Make sure jheadtran.exe is in the environment PATH, e.g. PATH=%PATH%;C:\Path\to\jpegtran.

I suggest the -ft flag to "Set file modification time to Exif time".

1
  • 1
    They are also on chocolatey, so you could install head and jpegtran with choco install -y jpegtran jhead and then just go to your directory and execute jhead.exe -autorot *.jpg May 18, 2020 at 15:50
10

Windows 7 has PowerShell installed by default, which can be used to script image editing thru either WIA (Windows Image Aquisition) or the .Net system drawing object. Here's a quick powershell script using the .Net method to rotate all the jpg's found in the current directory by 90 degrees clockwise.

[System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
dir *.jpg |
ForEach-Object {
  $image = [System.Drawing.image]::FromFile( $_ )
  $image.rotateflip("Rotate90FlipNone")
  $image.save($_)
}

Rotation is limited by 90 degree increments, including image flipping orientation.

2
  • 1
    This works great, but it is missing one important detail from the question: rotating the picture to the correct orientation based on EXIF metadata.
    – iglvzx
    May 15, 2012 at 0:06
  • 1
    If the rotation operation is based on the requirement that the camera has the Orientation sensor available, and that all images have the EXIF orientation field set, then you can use the WIA library to check that attribute. Here's how to check if it exists and its value: if ($imageWIA.Properties.Exists("274")) { $imageWIA.Properties.Item("274").Value } Where the values are: $orientation = @{ 1 = "Horizontal"; 3 = "Rotate 180 degrees"; 6 = "Rotate 90 degrees clockwise" ; 8 = "Rotate 270 degrees clockwise" } Also need to load WIA reference and image into WIA.
    – jdh
    May 15, 2012 at 3:36
4

Go to directory where is all your photos. Change to Details View. Right click on one column and Click More. Tick appropriate EXIF detail and OK. Now filter all files based on this EXIF detail and finally select all photos, right mouse to rotate either clockwise or counterclockwise.

3
  • 1
    As of 2018, this should be the selected answer.
    – mins
    Sep 2, 2018 at 9:04
  • @mins totally agree This should be selected answer
    – hsinghal
    Jan 5, 2019 at 5:08
  • 3
    Windows 7 does not rotate correctly, because the EXIF flag for the orientation gets not removed. This may result in a 180° rotation.
    – ceving
    Apr 1, 2019 at 12:33
3

I am pretty certain there is no way to rotate images based on EXIF info using only standard apps that come with Windows. However I thought that for the benefit of others who might have less stringent requirements, I mention 2 other ways.

I would recommend XNView: http://www.xnview.com/en/xnview/ (not XNViewMP) for JPEG lossless rotation (if you are ok with possibly losing a few pixels off the edges, as it is inherent limit of lossless jpeg operations): XNView

If you are not ok with losing any pixels on the edges, and/or want to save results in a different format, or want to perform additional manipulations in an intuitive way (XNView's batch processing is somewhat hard to use IMHO), I recommend Batch Image Resizer, which is a paid app: http://www.binarymark.com/products/batchimageresizer/default.aspx Batch Image Resizer

EDIT: The new version of Batch Image Resizer support automatic image rotation based on face recognition. It can detect human faces in your photos and automatically rotate images accordingly. It can be useful when EXIF orientation tags are missing for example and you have 100s of images you need to rotate:

Face-based auto-rotation

Disclaimer: I use both programs daily: XNView for viewing/organizing images, Batch Image Resizer for bulk image processing.

2
  • XNView is not free for commercial usage.
    – ceving
    Apr 1, 2019 at 12:34
  • jpegrotate.com / JPEG Autorotate can provide a cleaner interface and rotate based on EXIF data automatically. Disclaimer: I'm the author. Mar 7 at 19:11
-1

Used the following to rotate a jpg sourced from a csv file:

function batchRotateFromCSV([Parameter(Mandatory=$True)] $csvFile) {
    [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")

    $imageFormat = "System.Drawing.Imaging.ImageFormat" -as [type]

    Import-Csv $csvFile | Select PathToImage | ForEach {
        $image = [System.Drawing.image]::FromFile($_.PortraitFile)
        $image.RotateFlip([System.Drawing.RotateFlipType]::Rotate90FlipNone)
        $image.save($_.PathToImage, $imageFormat::jpeg)
    }
}

You can of course change the file format of the image as well..

Note that PathToImage will be the name of the header in your CSV.

3
  • Read the question properly before answring
    – traveh
    Jan 7, 2017 at 7:49
  • @traveh Can you look in the history to make sure the op didn't change the question since I answered this?
    – leeand00
    Jan 9, 2017 at 17:07
  • Yeah, I actually did. He didn't. He did emphasize and repeat it it for people who don't bother to read the question properly, but he didn't change anything.
    – traveh
    Jan 9, 2017 at 17:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.