Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Very low quality on zoomed DNG #1054

Open
mnogueron opened this issue Feb 25, 2024 · 1 comment
Open

Very low quality on zoomed DNG #1054

mnogueron opened this issue Feb 25, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@mnogueron
Copy link

Describe the bug
I have the load high res on zoom setting enabled but I'm having issues when zooming on DNG picture. Some are very low quality (DNG: 6000x4000, preview: 256x171) and some others are alright (DNG: 4032x3024, preview: 1280x960).

After some digging, I found out that the issue seems to be coming from Imagick. I tried to replicate the code from getImageJpeg

private function getImageJPEG($blob, $mimetype): array
straight into the PHP terminal:

$file_path = 'my_picture.DNG';
$blob = file_get_contents($file_path);
$image = new Imagick();
$image->readImageBlob($blob);
$image->setImageFormat('jpeg');
$image->setImageCompressionQuality(85);
$image->writeImage('preview-output.jpg');

Applied to both file, it generates the same output as what Memories gives me.

Exiftool gives me the following:

exiftool -json -preview:all my_picture.DNG
// Non working file
[{
  "SourceFile": "non_working_test.DNG",
  "JpgFromRaw": "(Binary data 1774170 bytes, use -b option to extract)",
  "PreviewImage": "(Binary data 53688 bytes, use -b option to extract)",
  "ThumbnailTIFF": "(Binary data 131544 bytes, use -b option to extract)"
}]
/// Working file
[{
  "SourceFile": "PXL_20230903_184954003.dng",
  "PreviewImage": "(Binary data 169066 bytes, use -b option to extract)"
}]

By extracting the previews for both files, it seems that Imagick uses PreviewImage in the case of my working DNG, but uses ThumbnailTIFF in the case of the non working DNG. (the extracted ThumbnailTIFF gives me the low quality preview of 256x171).

I've been trying to understand how Imagick handles the DNG load and conversion, but to no avail...
It seems ImageMagick uses a delegates.xml file to delegate encoding/decoding for certain file type, and DNG is part of the config, but uses ufraw-batch which is deprecated and not installed on my system, but still loads without it. So I'm really confused as to what to do to prevent Imagick to pick the law quality Tiff preview in my DNGs...

To Reproduce
Use the files (zipped for Github):
non_working_test.DNG.zip
PXL_20230903_184954003.dng.zip

Platform:

  • OS: any
  • Browser: any
  • Memories Version: 6.2.2
  • Nextcloud Version: 28.0.2
  • PHP Version: 8.3.3
@mnogueron mnogueron added the needs triage To be triaged label Feb 25, 2024
@pulsejet
Copy link
Owner

pulsejet commented Mar 5, 2024

So I've no experience with this and can be little help here. Though I'd say one way to deal with this is to shoot both JPEG and DNG and have them in the same folder with the same name. Memories will then collapse them into one file so you can view the JPEG your camera generated and use the DNG in whatever dedicated software you use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants