Image from Perspective mobile - rotation problem

I am having a small problem with the file upload. When I upload an image from desktop rotation is fine.

When I upload from mobile device or mobile camera, the image is rotated 90 degrees. Phone is Android.

Is there a way to determine this when the file is uploaded? and I can do a transform when putting the image in the database.

The issue is that JPEG allows rotation to be specified in the photo’s metadata, but not all viewing clients honor those flags. Mobile devices typically use the metadata so they don’t have to actually re-arrange the data from the camera sensor. I don’t recall if java’s will make the adjustment. You might want to experiment with it.


I have discovered that there is one landscape orientation where the image is correct. I will look into the to see if I can get this data. I am doing other things to crop and compress the image before storing it. So, doing a rotation or AffineTransform would not be an issue, if I can find the correct metadata that indicates rotation.