mvysny / photocloud-frame-slideshow

Android Digital Photo Frame
https://www.android-photo-frame.eu
15 stars 1 forks source link

Portrait format images not being rotated when viewing embedded jpeg image inside raw/dng files #174

Open rajdude opened 2 years ago

rajdude commented 2 years ago

Hello Martin, Would it be possible to fix this issue?

If the "try loading thumbnails from RAWs" is enabled, a portrait format image in a .dng file is displayed incorrectly. (It is shown rotated 90 degrees counter-clockwise).

Note: If I disable the "try loading thumbnails from RAWs" setting, portrait format .dng images are now displayed correctly. However two problems are there:

  1. It takes a few more seconds (more time)
  2. The edits I have done in Lightroom (brightness, color, cropping, etc) are not shown < this makes sense, since PhotoCloud does not know what edits Lightroom has made. The embedded jpeg inside dng has those edits.

Thank you for checking this out -Raj

rajdude commented 3 months ago

Hello Martin, A couple of years have passed, and I would really like to get this fixed. Can I pay you something to get it done? In the past I had posted a bounty on a fix I really needed, but that website (bountysource) is now gone. Is there any other way to put a bounty on my issue?

-Raj

rajdude commented 3 months ago

THANK YOU Martin for looking at this :-)

Today, I was using another app - "File manager plus" to view my .dng photos. It is able to show them, next-previous buttons also work on my TV remote, but it has the exact same problem as PC. Portrait orientation photos are shown sideways by that app also. So I did a little bit more research, and on the internet, I hear that that happens because the raw file converter being used by the app has some setting which needs to be set, or the library needs to be changed. For example, here is one developer of a different app having the same problem and eventually fixing it… https://github.com/immich-app/immich/issues/546

More specifically, I quote from that thread: After small insight, I found that the problem come from our libraries exifr and sharp. I have also tried on 2 other libs (exiftool and exiv2) and both gave good results. I think this issue may be fixed with #232 once we have selected the appropriate library for reading and writing exif data.

Not sure if this is the same problem in our PC app.

PS: I sent an e-mail to the developer of file manager plus. Lets see what he says.

rajdude commented 3 months ago

One more thing I would like to mention. In my first post above, I said this: Note: If I disable the "try loading thumbnails from RAWs" setting, portrait format .dng images are now displayed correctly. I said that in 2022

Today, when I test this, this is no longer true. Even if I disable that setting, the portrait format .dng images are still shown sideways. I did clear PC's cache. I tested this on my TV fed by an NVIDIA Shield box and also on my Google Pixel 5 phone. Same result.

mvysny commented 2 months ago

I disable that setting, the portrait format .dng images are still shown sideways

That's good to have a consistent behavior at least :) .

The way this works is that libraw library loads the RAW image; then I use com.android.support:exifinterface:28.0.0 to load the EXIF data from the RAW and rotate it manually in-memory. There could be number of ways this could go wrong:

  1. The EXIF fails to load - there is an error message "error loading exif" logged in the Android log
  2. The exifinterface library fails to load EXIF from RAW - you can verify that by checking the EXIF data in the slideshow - if there are only basic data then EXIF was not loaded properly. This could be since exifinterface is rather old and deprecated.
  3. The EXIF data was loaded incorrectly and the rotation data was misread. That's hard to check since, upon successful rotation, the EXIF data is written back with the EXIF rotation value set to ORIENTATION_NORMAL (1)

Unfortunately PhotoCloud is now in maintenance mode - I have no time to develop it further, and only critical bugs will be fixed.

rajdude commented 2 months ago

Martin, I understand your situation. Would it help if I paid you to fix this? How about 20 bucks?

My problem is - your app is literally the ONLY app for Android which does what I want (slideshow of .dng photos from my own server over SMB network connection). So, other than me trying to write an app myself (which I have zero experience with) I have no other way to run a slideshow when my TV is idle. All my hundreds of thousands of photos keep sitting on my server :-(

mvysny commented 2 months ago

Thank you kindly for your generosity, while it doesn't fix the underlying problem - that the app can't make reasonable money on Google Play - it's definitely not anything. Perhaps if you could attach one of the RAW images here (you can zip it, then you will be able to attach it here), I could then investigate what's wrong. But unfortunately I can't promise anything at this point.

rajdude commented 2 months ago

Thanks for trying, Martin. Here is a sample .dng photo in the portrait format from my camera (it was too big to attach here, even after zipping it) https://1drv.ms/i/c/dbeaf136655aa37c/EYlrTqbq-oNOqkAfVPeASUEBVnASvth9lSh_fKUrwUjX-A?e=2bT3xJ

mvysny commented 2 months ago

Thank you. I've downloaded the image and I can unfortunately see the problem right away: the DNG files apparently do not have any EXIF data associated. On my Linux:

exif portrait\ sample.DNG 
Corrupt data
The data provided does not follow the specification.
ExifLoader: The data supplied does not seem to contain EXIF data.

That means that PhotoCloud doesn't know that the photo is rotated, and can't rotate it correctly. The DNG parser library PhotoCloud uses, apparently ignores this setting too, since it loads the image unrotated.

I unfortunately don't think there's much I can do... I'm using the libraw library, unknown version, and that's pretty much all that exists on Android AFAIK. I'll keep this bug open so hopefully someone can point me to a better RAW-loading library, but until then there's not much I can do.

Your best bet is to mass-convert those RAWs to JPEGs. You can keep RAWs for editing while leaving JPEGs to be shown by PhotoCloud.