How do I rotate a lot of digital photos by 180 degrees in one operation?
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.
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
jpegtranwhich 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.
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!
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 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.
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 Glad I could help. On the edit to the question, see http://meta.photo.stackexchange.com/questions/1601/should-edits-which-add-the-accepted-answer-to-the-question-be-reverted
@mattdm Should I edit the marked Answer then? What's the correct way to communicate the actual solution?
@Johns-305 Checking the "accepted" checkbox as you've done communicates that the answer worked for you — no need to do more. If you _do_ want to add more details, you can add them as comments here (also like you did). If it's a simple addition, editing the answer is okay; if it's a complicated change, you can actually post that as your _own_ answer.