Igor Kromin |   Consultant. Coder. Blogger. Tinkerer. Gamer.

It's been over a year since I released the last version of jPhotoFrame. Lately I had a few issues with some photos not rotating correctly so I decided to add an image rotation utility and release a minor update to jPhotoFrame. So version 0.3.1 is now available to download from GitHub.

The source code is of course still in the same spot - https://github.com/ikromin/jphotoframe.

This release addresses the issue of incorrectly rotated JPEGs. This can happen when you hold your camera/phone in an unusual orientation while taking a photo. Since the orientation of the data inside the JPEG and how the image is meant to be displayed do not always match, it's possible to get some images being displayed with incorrect rotation. Most modern tools take care of this orientation mismatch for you so it's usually not noticeable. You can learn about this more here.

However, because jPhotoFrame is just using vanilla Java code to load and display JPEGs it was doing things like this sometimes...
IMG_0424.jpg


Oops! That particular image should have been rotated by 90 degrees to the right.



Based on this and with the aid of the mediautil library I put together a small utility to recursively fix image orientation for all JPEGs in a directory. This utility scans the entire directory and all of its subdirectories, tries to load any JPEGs it finds and if the orientation needs adjustment, it rotates the image data to a standard orientation and overwrites the original file.

The output looks something like this...
 Output
Reading file - /Personal/tmp/photos/20170211_152556.jpg
EXIF data found in image
Transforming image to correct orientation
Frame, precision 8
X= 1024, Y= 768
Components 3 (/Personal/tmp/photos/20170211_152556.jpg)
Size in MCU 64x48
0x51dd8(335320) byte(s) read in 20170211_152556.jpg
Writing image to disk


The end result is correctly oriented images!

Running this utility is a matter of running the fixrotation.sh script or doing something like this...
 Command
java -Xms128m -Xmx256m -jar jphotoframe.jar -fixrotation /Personal/tmp/photos


Here the directory name is /Personal/tmp/photos. As mentioned earlier this utility will attempt to fix all JPEGs in this directory and all of its subdirectories.

I ran this on a few hundred images and it runs pretty fast and so far has worked quite well. Don't forget to look at the README and download the latest version 0.3.1 package here.

-i

Please leave your comments or feedback below!
comments powered by Disqus
Other posts you may like...
Hi! You can search my blog here ⤵
Or browse the recent top tags...

Recent Blog Posts

Coherence and weblogic.xml in different types of J2EE web app deployments

Atari Lynx repair - Part 5 - McWill LED screen mod installation

Atari Lynx repair - Part 4 - screen cover replacement

Atari Lynx repair - Part 3 - broken speaker replacement

Atari Lynx repair - Part 2 - re-capping the motherboard

Atari Lynx repair - Part 1 - introduction and case disassembly

jPhotoFrame updated to version 0.3.1 with an image rotation correction utility

iOS 11 pre-GM mini review before it gets revealed next week

Why you should never use Java enums as keys with Oracle Coherence caches

Hacking the VideoPak 7inch promotional brochure to work as a digital photo frame

Recent Galleries

Atari Lynx repair - Part 5 - McWill LED screen mod installation

Atari Lynx repair - Part 4 - screen cover replacement

Atari Lynx repair - Part 2 - re-capping the motherboard

Atari Lynx repair - Part 3 - broken speaker replacement

Atari Lynx repair - Part 1 - introduction and case disassembly

Building a custom Atari Lynx game box storage shelf unit in a day

Protecting old Atari Lynx game boxes with snug fit plastic sleeves

Monument Valley 2 is released and does not disappoint

Space Food - Chocolate Ice Cream with Chocolate Chips

Legeod Star Wars AT-DP kit

Blogs and Friends

Matt Moores Blog
Georgi's FlatPress Guide
Perplexing Permutations
The Security Sleuth
Ilia Rogatchevski
Travelling Fairy

Blog Activity

Blog Activity