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

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

Using DeoxIT to repair old game catridges

WebLogic Maven Plugin - How to fix the MojoExecutionException: The artifact location was not specified

jPhotoFrame version 0.4 released with a whole new layout engine

Upcycling a couple of old broken lamps to create something amazing

A custom exception mapper and writer for a RESTful JAX-RS Jersey service

How to fix Plex error - Sorry there was a problem playing this item

Jersey JAX-RS filters and interceptors execution order for a POST request

Fix your Mac - users not showing on the macOS login screen when FileVault is enabled

BMB-012 Nanoblock T-Rex Skeleton Model assembly

Writing a custom MessageBodyReader to process POST body data with Jersey

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