SmilyOrg / photofield

Experimental fast photo viewer.
MIT License
402 stars 7 forks source link

DNG files render with wrong colors/lighting #55

Closed DawidPietrykowski closed 1 year ago

DawidPietrykowski commented 1 year ago

After loading my library, I noticed that theres a lot of dark images from a few days. It turns out I was on a trip and I was taking photos in RAW, so DNG files from my Pixel4a.

This is what the image looks like in the browser: image

This is what it should look like: image

Example image: PXL_.tar.gz

I'm running it with docker-compose.

SmilyOrg commented 1 year ago

Nice shot! 🙂 This seems to be an issue in FFmpeg, all the raw files I tried either didn't render at all or they were very dark.

Perhaps I can tell it to bump up the brightness just for these specific raw file extensions? Ultimately for proper support I might have to integrate something else, like libraw.

Thanks for the sample! Somehow they're not that easy to get. 😁

DawidPietrykowski commented 1 year ago

Interesting, did you check some other DNG files? Maybe it's just my phone format being wrong in a slight way, I will try to check some other files from different devices.

I will try to reproduce it with ffmpeg and check if there's a way (maybe some additional options) to make it output images with the right look.

SmilyOrg commented 1 year ago

Interesting, did you check some other DNG files? Maybe it's just my phone format being wrong in a slight way, I will try to check some other files from different devices.

Yeah, I tried it with some examples I grabbed online from Signature Edits, you can see that they're also dark in the demo.

I will try to reproduce it with ffmpeg and check if there's a way (maybe some additional options) to make it output images with the right look.

That would be very helpful, thanks! :)

DawidPietrykowski commented 1 year ago

Unfortunately I wasn't able to fix the issue completely, but I managed to come up with some options that make it look close to the target images (at least for my samples).

I also found some forum posts complaining about this issue, but found no solution.

Here's what I got: PXL

With cli command: ffmpeg -i PXL_.dng -vf eq=brightness=1.1:saturation=3:contrast=3.4:gamma=2 PXL.jpg

But more importantly, I also tried it with imagemagick, and it worked great out of the box: magick PXL_.dng PXL.jpg

So I guess switching to it for this format might be a solution, but I know that adding additional dependencies is not always the best options so I guess you'll do what you find best :)

SmilyOrg commented 1 year ago

Hey, 0.9.4 has that hack now integrated. For proper support I'll have to look into something else like imagemagick as you say, but I'm afraid to bring in that rabbit hole of a dependency 😅

SmilyOrg commented 1 year ago

Thanks for the help!