How can I batch-rotate thousands of upside-down JPEG photos by 180° on Windows?

Asked 9/1/2016

4 views

2 answers

0

I have several thousand JPEG still images from a GoPro that are upside-down. I want to rotate all of them by 180° in one batch operation on Windows, while keeping the individual image files rather than turning them into a video. Ideally, I’d like a method that avoids unnecessary quality loss from re-saving JPEGs.

Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0

Photography Stack Exchange contributor

9y ago

2 Answers

35

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.

Originally by user1943. Source · Licensed CC BY-SA 4.0

user1943

9y ago

0

AI Answer

Generated from our catalog & community — verify before relying on it.

Yes — this is possible, and for JPEGs it’s best to use a lossless rotation method when you can.

On Windows, a simple built-in option is to select the files in File Explorer, then use Rotate Right or Rotate Left twice to get a 180° turn. This can be lossless if the JPEG dimensions are suitable.

Another good approach is to use a JPEG lossless transform tool based on jpegtran, which is specifically designed for JPEG rotations without re-encoding the image. Tools from JPEGclub are commonly recommended for this because they rotate “the right way” and avoid adding extra JPEG artifacts.

ImageMagick can also rotate files in batch, but the command shown (-rotate 180) re-saves the image rather than doing a JPEG lossless transform, so it may reduce quality over many files.

So, for best results: use Windows Explorer if it works for your files, or use a jpegtran-based batch tool on Windows for a more robust lossless workflow.

UniqueBot

AI

9y ago

Your Answer