20

I have several thousand images taken with a GoPro that are upside-down.

I'm looking for a way, an app really, that can flip them all, 180 degrees, in one operation.

I have looked at every option in GoPro's own software, but do not find this for stills only. You can rotate while making a video, but I want to keep the individual images.

I'm on Windows.

13 Answers 13

31

I would recommend any of the applications from this list at JPEGclub.org, which develops and maintains software for the Independent JPEG Group. They have a free piece of code called jpegtran which can do some basic transformations (like rotation) without re-encoding the image.

Rotating images the "naive" way (rendering to a bitmap, reorienting the bitmap, and re-saving) can result in increased JPEG artifacts — and bigger files with less useful data.

The list above contains software which is known to do it "the right way". Other software may as well (perhaps using a different code base), but ImageMagick is not one of them, unfortunately. But, as of August 2016, there are 87 different options for many different computing platforms, including Windows.


Note from comments: the OP used this loop based on this answer:

FOR %f IN (.\Src\*.*) DO jpegtran.exe -rotate 180 %f .\Rotated\%~nxf

with good results.

  • 1
    Note that lossless rotation works only if each dimension of each image is a multiple of 16 pixels – 8 if chroma subsampling is not used. Otherwise either the excess pixels are lost or the image will be padded with a border. For example, 1080 is not a multiple of 16! – Gnubie Sep 2 '16 at 9:53
  • 2
    I second the recommendation of jpegtran; even better, if you care about keeping the EXIF's thumbnail and Orientation tag consistent, you might consider exiftran which is unaccountably absent from the JPEGclub list, but is lossless. My command (on Linux) for this would be exiftran -i -1 *.jpg or find . -name '*.jpg' -print0 | xjobs -0 -l 10 exiftran -i -1; this will need adapting for Windows shell. – Toby Speight Sep 2 '16 at 9:59
  • @Toby Good addition. Many (most?) of the listed programs will also preserve and update metadata, which is one reason I recommend one of them instead of just jpegtran directly. – mattdm Sep 2 '16 at 13:26
  • Thank you! I used jpegtran on Windows. The rotate 180 is exactly what I needed. I put exact batch command in the question for future ref. – Johns-305 Sep 3 '16 at 20:56
  • @Johns-305 Glad I could help. On the edit to the question, see meta.photo.stackexchange.com/questions/1601/… – mattdm Sep 4 '16 at 1:39
9

You could use ImageMagick with the rotate option:

convert image.jpg -rotate 180 result.jpg

You should be able to apply this command to multiple files, depending on your environment.

  • 10
    Note though that this will reencode the jpeg, losing quality. – mattdm Sep 1 '16 at 16:40
8

On Windows you can do it without any extra software in TWO operations. Select the files you want rotated in file Explorer, right click and do "rotate right" (or left) twice. It will be done losslessly if the image permits (eg, the dimensions are not "funny").

  • What are "funny" dimensions? Why would a photo's dimensions prevent lossless rotation? – scottbb Sep 2 '16 at 21:54
  • 2
    After reading Are “Windows Photo Viewer” rotations lossless?, I understand now. Both dimensions need to be a multiple of 8 in order to be losslessly rotated. – scottbb Sep 2 '16 at 22:17
  • 1
    This is the best answer. I joined the site just to upvote this. – fi12 Apr 17 '18 at 22:41
5

You can use xnview on windows, which has some batch mode processings and also, for a simple rotation of images, have the option to rotate images based on the exif data.

Select all the images (even the correctly oriented ones! It will know they are already well oriented), "rotate based on exif" and it will do it (without recalculating the jpg, so with no loss of quality).

Like they say on http://newsgroup.xnview.com/viewtopic.php?t=1420 :

To do this, you select all your images and select "Tools > JPG Lossless tranformations" (or dropdownlist of symbol 'JPG lossless transformations' in toolbar). In the dialog check the button with "EXIF" on it and then press "Go". XnView will permanently rotate the images based on the EXIF orientation flag.`

And for next time, if you have a recent enough gopro, you may want to check it's feature as well: https://gopro.com/support/articles/what-is-auto-image-rotation

  • Does the GoPro actually save the correct EXIF orientation data? The Hero4 / Session have an orientation sensor, but I don't think any of the older models do. – vclaw Sep 1 '16 at 23:43
4

Assuming your photos are in JPEG format, I'm quite partial to JPEGCrops, a simple and free tool for lossless batch processing of images.

You can crop to specific aspect ratios, and/or rotate.

4

May I suggest the batch mode of Irfanview, which only runs on Windows. Irfanview is also good for simple edits, but it is no GIMP.

Once installed, select "File | Batch Conversion/Rename". From there it gets a bit tricky, you need to select all the files, you need to specify a destination folder, and you need to click on the Advanced Button to see Advanced options. It can rotate +/-90°, but to do 180° you will need to pick fine rotation on the far right and enter in 180°. Note that you can also resize them, change JPEG quality, and rename them.

You can also do it rather quickly by staying in the GUI and using the keyboard. Open any file in the folder of pictures. Press 'R' two times to rotate twice. Then press Ctrl-S to save. Two windows will show up, one your typical file dialog, and a second one for JPEG compression (if GoPro's default format is JPEG). I would make sure the Quality Factor is at least 90%. Then save the file; you should be able to press the Tab key or Alt-S to save. An "Are you sure" type dialog might show up (might be able to turn that off). Then, just press the Space bar to advance to the next file in the folder. If you have 50+ files, the batch might be quicker. Ten files, I just do the above.

Key thing to Irfanview is that its like Blender, it doesn't ask you if you want Save if you modify an image.

  • 3
    That will do a lossy rotation - as its rotating them, then resaving the JPEG, so you are losing quality. In IrfanView, better to use the "JPEG Lossless rotation" feature (Shift+J). Note you can use the thumbnail view to select all of your images, then rotate them all at once. – vclaw Sep 1 '16 at 23:24
  • 1
    @RocketFeathers - Irfanview is the easiest tool with which to do this losslessly in a Windows environment. But like vclaw says, it's much better to use the "JPEG Lossless Rotation" to do it. Edit your answer to reflect that and I will upvote it. – Michael C Sep 1 '16 at 23:43
  • "it doesn't ask you if you want Save if you modify an image." - This can be changed in Options > Properties/Settings... > Ask to save changes on program exit. – MrWhite Sep 4 '16 at 8:59
3

FSViewer is a useful program that can do that.

Open up the folder where the images are, select all that you want to rotate, hit F4 and go to the 'Batch Convert' tab in the window that opens up. Click 'Advanced Options' on the bottom right, go to the 'Rotate' tab. Check 'Flip / Rotate', then 'Rotate', then select '180' below and hit OK. Set where you want these saved and hit 'Convert'.

Edit: a quicker and more painless way is just to select all the images you want and hit twice 'Rotate right and save' in the toolbar. Should be non-destructive for JPEGs.

3

With windows you can mark all if them in the explorer then right click and choose rotate clockwise. Do this two times and your pictures are now rightly orientated.

2

Do you know GIMP? There is a plugin called BIMP that lets you perform the same operation on a set of images, using a graphical interface. You can easily install it using the official installer for Windows.

You can also re-save them in another format or with different compression ratio to avoid big quality loss.

Pro tip: I made it :D

  • 2
    I think you meant to say "Disclaimer" rather than "Pro tip" :p But great software! I have needed batch operations on GIMP once in a while and resorted to writing matlab code instead. I will keep your tool in mind for next time :) – Tasos Papastylianou Sep 2 '16 at 9:32
1

ImageMagick is a set of command line tools that operate on images, and you can combine those tools with basic Unix shell commands to apply the same command to a set of files. There are a lot of good examples at How to rotate all images in a directory with imagemagick?.

  • Um... and if the OP is on Windows and doesn't use Cygwin...? :) Might want to add "and Windows batch files" or expand the answer to indicate ImageMagick isn't necessarily a UNIX-only solution, just a command line one. – inkista Sep 1 '16 at 16:28
  • 1
    Will give it a try this afternoon. There are Windows binaries available. – Johns-305 Sep 1 '16 at 16:37
1

I personally use Adobe Lightroom. Images can easily be batch roted and edited, just select the images you would like to rotate, right click, and select the option to transform the images by rotating 180 degrees.

If you are consistently working with thousands of images that require batch processing, particularly if it is more complex than rotating - like adjusting color or exposure, then LR is probably a solid investment.

I don't like that Lightroom is closed source, costs money, and won't run on Linux systems. However, I have found that the features far exceed what is available for free.

0

You could use LiveBlox and build a pipeline to allow rotating of the image. The demo version on http://liveblox.org has a rotation block so will allow this to be done.

There is a tutorial https://www.youtube.com/watch?v=kY0e5msQuiU that shows how to make the batch image resizer, you'd just need to replace the fixed size resize with the rotator to do the rotation.

This would allow you to work on each image with a single click.

-1

$ for F in *jpg; do convert -rotate 180 $F "$(basename $F .jpg)_R.jpg" && echo "Done $F"; done

Explanation: *for F in .jpg portion of the command assigns the filename to a variable, which can be recalled later to rename the file to [original file name}_R.jpg

the "do convert -rotate 180" tells the computer that you would like your images converted, by being rotated 180 degrees.

The "$(basename $F .jpg)_R.jpg" portion of the command indicates the new file name.

The && tells the computer than an additional command is coming, but that the computer is only allowed to execute the command if the previous (rotating and renaming) command was successful.

echo "Done $F" tells the computer to tell you ("echo" to you) that each file has been successfully rotated. $F sub-portion of the command is recalling the initial filename variable, so the output will probably say something to the effect of "Done file1.jpg"

And, one needs sh/csh/bash for this piece to work.

  • 5
    That's possibly working, but without an explanation, it's not a good answer. Please explain in what context this solution if applicable. – null Sep 1 '16 at 21:17
  • 1
    Is this an expansion of null's answer using ImageMagick? – MikeW Sep 1 '16 at 23:05
  • This doesn't work as expected if there are already *_R.jpg files in the directory. – pts Sep 2 '16 at 8:55
  • Thank you for the clarification, I'm not sure if installing a UNIX shell on windows is a practical approach, but it is an approach no less. – null Sep 2 '16 at 10:16
  • pts, you can change the _R.jpg to whatever you want (like "_rotated.jpg"). You are correct that this will be problematic if you already have _R.jpg files in the directory. – SB Ph.D. Sep 2 '16 at 20:31

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.