How to rotate jpg pictures?

Is there an easy way to rotate jpg pictures? My son sent me several hundred and about half of them are “sideways”.

Any number of programs can do this. Microsoft Photo Editor (included with earlier versions of MS Office, just not part of the default install) does it. MS Picture Manager (included with later versions) does it.

ACDSee (photo managing/viewing software) does it.

Most of the programs which rotate JPEGs will cause the quality to deteriorate. Make sure you select a tool that claims it can “losslessly” rotate JPEGs. If you are familiar with compiling and running command-line tools, you can use the software provided by the official JPEG Committee. Otherwise you’ll have to look for something that meets your needs and runs on your operating system.

I use irfanview, it’s free and the comand shortcuts to rotate are l and r

Remember to save photos after rotating them, if you want them to stay rotated.

Second Nava’s IrfanView recommendation. You can even do batch jobs.

On a mac? Use Graphic Converter.

I should have specified Win XP as the OS. I will search for IrfanView. Thanks for the replies.

You can do this directly in Windows Explorer - turn on Thumbnail view, select (using the CTRL key) all the sideways images, right click on the last one and select Rotate Clockwise (or Rotate Anticlockwise). This is lossless (unless the image was a progressive jpeg, in which case it will be converted to a standard baseline jpeg).

This is a lossless JPEG rotator that will work in Explorer, too.

Si

Irfanview has an option to rotate losslessly, but it’s under a different menu option than the regular rotate, which is not lossless. It’s under OPTIONS:JPG Lossless Rotation.

Hm, I never realized a simple rotation would compress a JPG further than it’s already compressed. Why does that happen?

Why would lossy rotation be the default, anyway? For multiples of 90 degrees, at least, lossless rotation would just entail a straightforward shuffling of arrays, and would almost have to be simpler than any sort of lossy method.

Lossless jpeg rotation just involves setting an orientation flag in the jpeg image header. Many modern cameras also set the camera orientation in the EXIF data, and most photo editing tools can auto-set the image orientation from the camera orientation. Jpeg display libraries should honour the jpeg orientation flag.

You cannot just shuffle arrays because jpg files are not arrays of bytes, it is a stream that encodes clusters of data. So any rotation involves decompressing the data into a bitmap, rotating the bitmap (which is shuffling arrays) and then recompressing the image to a new jpeg. But the data you have to compress is not the original image, it is the decompressed jpg with compression artifacts. Which then gets compressed into an image with more compression artifacts - losing more of the original data from the final rotated jpg.

Si

Do you know if Photoshop does this by default? I’ve been using Photoshop to rotate images for a long time (among other things, of course) and it never occurred to me that I might be compressing it further with every single rotation.

Aren’t you converting your master .jpg images to the native .psd format before manipulating?

As far as I know, Photoshop doesn’t do lossless JPEG rotation. If you resave a JPEG as a JPEG, you will lose some data. If you save your rotated JPEG in a lossless format, you will not.

To be honest, if you use fairly high quality settings for your JPEG compression, an extra pass through the algorithm is not going to be noticeable for the vast majority of photographic data (I’m not talking line drawings and the like here.) In fact, I make prints of JPEGs of JPEGs all the time (at 80% quality setting), and darned if I can tell the difference. Yes, ideally you always want to keep the highest possible quality file around. I keep RAW files of every last thing I shoot. But I don’t freak out if I need to make a print of a JPEG of a JPEG. It looks fine, unless you’ve compressed it to holy hell (or if it’s not a typical continuous tone photographic print.)

Because most programs aren’t just designed to rotate, but to edit the image, and thus convert it to Bitmap first. And then, when you save, it converts that image back to JPEG. It’s only specialized JPEG rotation utilities (or commands) that actually alter the JPEG file itself.

Picasa, free from Google, does this and much much more. And it’s very user friendly.

ETA: and it leaves the RAW format where it is.

Ah, this does explain a problem I (or rather, my father) have had. When I take a picture with my camera, I orient the camera for portrait or landscape according to what better frames the picture, and they show up on my screen oriented correctly. But when I send them to my dad, he always complains about the sideways pictures. Given that he uses Microsoft products exclusively, and given Microsoft’s attitude towards standards they didn’t create, they probably just didn’t implement the rotation flag.

Tell him to use Picassa - it’s free from Google and runs on Win and Mac and will respect the orientation sensor data from your camera.

There are a number of other tools on the Mac (to add an Apple flavour - most of the Windows options have been covered) - Preview (built into OS X) does it with Command+R and Command+L, Graphic Converter which has been mentioned, iPhoto, Aperture, Picassa, and any other large app like Photoshop/Photoshop Elements.

I’ve told him to use all sorts of things. But he’s convinced that the largest company with the most money logically must make the best of everything.