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.
I've now released verision 0.4 - please refer to this article - jPhotoFrame version 0.4 released with a whole new layout engine.


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

Have comments or feedback on what I wrote? Please share them below! Found this useful? Consider sending me a small tip.
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

Oracle WebLogic Maven Plugin wsgen goal not respecting the Maven Compiler Plugin version

How to fix Google Cloud SDK dev server error - No module named ipaddr

Adorable but totally metal - Metal Earth 3D Guardians of the Galaxy Groot model kit

Riverside Expressway Cam shut down permanently

Inserting Google DFP ads with Backbone, Underscore and jQuery

How to resolve the domain is already mapped to a project error in Google App Engine

A quick look at the Nyko Super MiniBoss wireless controllers for the SNES mini

Loading and displaying a collection from bootstrapped data in Backbone.js

Add this handy function to your Bash profile file to display the compiled JDK version for a .class file

How does PCBWay stack up as a low budget PCB fab

Recent Galleries

BMB-012 Nanoblock T-Rex Skeleton Model assembly

Tiny Arcade revision 6 kit assembly and decal application

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

Blogs and Friends

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

Blog Activity

Blog Activity