JPEG Rotation And Lossless Editing In iOS


A JPG rotated 900 times. Who says digital files don't rot?

Back up your photos. Always shoot in RAW. After a while all the good advice starts to sound like the adults speaking in Charlie Brown cartoons. Wah-wah-wah-wahwahwah.

Especially now iCloud manages our backups and our iPhones only shoot JPGs.

But one piece of advice is still worth listening to: “always rotate JPGs losslessly.” What?

The image above shows a JPG that has been rotated 2000 times. Or, more specifically, it shows the original plus the 900th rotation, in the middle of a 2000-rotation marathon by Wikipedian Burny. The 200th image is nothing but colored noise.

Fortunately, if you use your iPhone to take your photos (and who doesn’t these days) then you’re safe, at least if you use the built-in apps. The iPhone stores JPG orientation info as a flag set in the photo’s metadata. Thus, it is stored as shot, and not even rotated until you view it. This means that the JPG is not touched until you open in elsewhere and start mashing it up in editing apps. It’s also why iPhone photo thumbnails sometimes show up 90-degrees off in some apps – they’re not reading the EXIF data properly before displaying the picture.

More good news: if you make edits in the camera or photos apps, then these edits (even the crops and enhancements) are made losslessly, and the edits are stored in “XMP” sidecar files. This is what allows you to revert edits made in the Photos app on your iDevice at any time in the future. IPhoto for iOS will even send these files along with the images when you “beam” them to other iPhoto users.

Fortunately, every photo editing app on iOS will save a new file of your tweaked photo, as they’re not permitted to do anything but read from (and add new photos to) your camera roll. This can fill up a small 16GB iPhone pretty fast, but its a lot better than ending up with the picture at the top of this post.

Source: PetaPixel