FossifyOrg / Gallery

Browse your memories without any interruptions with this photo and video gallery
https://www.fossify.org
GNU General Public License v3.0
1.34k stars 41 forks source link

Wrong resolution displayed for RAW dng files #2

Open WhosyVox opened 7 months ago

WhosyVox commented 7 months ago

Checklist [X] I can reproduce the bug with the latest version. [X] I made sure that there are no existing issues - open or closed - to which I could contribute my information to. [?] I have read the FAQ and my problem isn't listed. (Is there an FAQ now?) [X] I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise. [X] This issue contains only one bug. [X] I have read and understood the contribution guidelines. -- This link needs updating to point to the FossifyOrg repositoriy

Describe the bug Raw (DNG) files taken on my Google Pixel device display an incorrect resolution in this app. While Google Photos and DarkTable both agree that the resolution is 3072x4080, according to the latest version of (still Simple Gallery Pro on the Play Store) it's only 1024x964.

To Reproduce Steps to reproduce the behaviour:

  1. Download the file linked below, taken on my Google Pixel device
  2. Open it in the Gallery app
  3. Click the Info button to view the resolution
  4. Notice the incorrect resolution

https://drive.proton.me/urls/X24WKSKSN8#SZ2MCg03YBaU

Expected behaviour The resolution reported should be in line with other applications.

Screenshots If applicable, add screenshots to help explain your problem.

Device info (please complete the following information):

Aga-C commented 7 months ago

The FAQ is inside each app (three dots -> About -> FAQ).

WhosyVox commented 7 months ago

I'll add that the resolution displayed by the app is consistent with the output of the Linux file command, which seems to treat it as a CR2 TIFF rather than x-adobe-dng.

glasswings commented 7 months ago

Reproduced in 3bb21f9 (master) Reproduced in ec396b1 (approximately 6.28.0 -- that release wasn't tagged) If you're aware of a version in which Gallery behaved behaved better, please mention it. It changes troubleshooting.

What I know about the cause:

Gallery reads the JPEG-encoded preview and ignores the RAW data. (the DNG format contains both, which is why file is similarly confused). This may be related to changes in late 2021-10 that were intended to comply with Google's storage privacy policies.


Gallery determines the resolution for the Properties dialog by asking Android's BitmapFactory to decode it. That's a very basic image file decoder and I'm sure it defaults to reading the thumbnail.

Next I did some change research and this getImageResolution function was added as part of the "scoped storage changes." Google changed policy for applications that look at the entire file system -- they felt that media players were snooping around too much -- and Gallery had to change to comply. It's possible that this change broke things. Late Oct 2021.

I'll see if I can get 6.22.0 to build, just a little bit before those changes. I'm curious what the behavior was.

glasswings commented 7 months ago

I couldn't build it (Gradle vs Kotlin nonsense :cry:) but I installed the binary. It detected the smaller dimensions. So I don't think this is a regression, Gallery has always ignored the full-size raw. My summary of the issue is

Raw images often have smaller thumbnails. Gallery detects and displays those, but it only shows the small resolution in image properties. Where are my megapixels? It may be better to report

3072x4080 (1024x964 preview)

The difference in quality shouldn't be noticeable unless someone zooms or crops in, but it's a nice touch


We may want a library that can detect the full resolution of the raw part. A less satisfying partial fix would just acknowledge that the dimensions are smaller - "1024x964 preview of raw."

I want to say the smaller fix is easy, but there's a twisty maze of method calls across two packages. Set a breakpoint on the line I linked above, try to open the Properties dialog, and you'll see what I mean. Maybe not good-first-issue easy.

The enhancement seems difficult. There is free software to decode raws - LibRaw - but it's a big C++ library.

viasux commented 5 months ago

I couldn't build it (Gradle vs Kotlin nonsense 😢) but I installed the binary. It detected the smaller dimensions. So I don't think this is a regression, Gallery has always ignored the full-size raw. My summary of the issue is

* user-experience: Display the resolution of raw+jpeg files better

Raw images often have smaller thumbnails. Gallery detects and displays those, but it only shows the small resolution in image properties. Where are my megapixels? It may be better to report

3072x4080 (1024x964 preview)

* enhancement: Display raw images in Gallery, not just their preview

The difference in quality shouldn't be noticeable unless someone zooms or crops in, but it's a nice touch

We may want a library that can detect the full resolution of the raw part. A less satisfying partial fix would just acknowledge that the dimensions are smaller - "1024x964 preview of raw."

I want to say the smaller fix is easy, but there's a twisty maze of method calls across two packages. Set a breakpoint on the line I linked above, try to open the Properties dialog, and you'll see what I mean. Maybe not good-first-issue easy.

The enhancement seems difficult. There is free software to decode raws - LibRaw - but it's a big C++ library.

The difference in quality is noticeable without zooming or cropping.

CTappe commented 5 days ago

I don't know if I have understood everything correctly in this thread. In my case, the RAW resolution is displayed correctly in the info box, but the RAW photo still looks like a low resolution preview photo and it has hardly any zoom capabilities. If I have understood the thread correctly, it should still be the same bug.