martin-marek / hdr-plus-swift

📸Night mode on any camera. Based on HDR+.
https://burst.photo
GNU General Public License v3.0
198 stars 9 forks source link

[Feature Request] Automatically convert non-DNG raws to DNG #4

Closed Alex-Vasile closed 1 year ago

Alex-Vasile commented 1 year ago

Instead of having the user manually convert to DNG before running the app. It would be really convenient if the user could simply drag in non-DNG raw files and the app convert them to DNG and them process those DNGs.

martin-marek commented 1 year ago

This would be possible, for example through LibRaw. In fact, if you scroll though the commit history, you'll find that a previous version of Burst Photo used LibRaw.

Unfortunately, in my personal testing, using LibRaw to read and write images resulted in degraded image quality. Moreover, you also loose some image metadata in the process.

I want Burst Photo to support all camera as well as possible, without any image quality / metadata loss. I believe that using a single standardized image format makes this much easier. I can rely on Adobe's DNG converter to convert almost all raw files perfectly, while relying on their SDK to work with the files perfectly.

If you are still interested in this, please feel free to fork Burst Photo and revert the switch that I made from LibRaw to DNG SDK. Alternatively, you could try using LibRaw together with Adobe DNG SDK (see the use_dng_sdk flag).

Alex-Vasile commented 1 year ago

I see. Sorry for not being more explicit. I was referring to something else.

I am used to using dng->dng workflow through https://www.heliconsoft.com for focus stacking. They also use Adobe DNG's convertor, requiring you to specify the location to Adobe DNG convertor.

After it's specified, you can draw other raw format directly into the application and it will call the convertor to go from priopriotery raw to dng on the fly.

martin-marek commented 1 year ago

Oh, I see. That sounds like a great idea, thanks!

I won’t be able to work on this right now, but if I have more time in the future, I might try implementing this 🙂

Alex-Vasile commented 1 year ago

I may take a crack at it as soon as I get some time myself. Would you accept a PR for it if I do?

martin-marek commented 1 year ago

If you can get it to work well, I would be very happy to. I’m thinking it could work like this:

The first time a user drag-and-drops non-dng raw files, an alert will appear. It will inform the user that if they want to use non-dng raw files, they need to install Adobe’s DNG Converter and locate it in finder. The user can then either dismiss the alert (and get no output) or click something like “Locate”.

After they locate the Converter, the Converter will create temporary dng files. These can then by processed by the existing pipeline. After the output image is saved (or if any part of the pipeline fails), the temporary dng files are deleted.

Burst Photo will remember the location of the Converter, so the user only has to locate it once.

Would you like to implement both the UI and the backend changes? I’d be happy to help with either. Also, I’m open to any suggestions on how to do this differently.

Alex-Vasile commented 1 year ago

Yup that's almost what I had in mind. The only change i would make is that Burst Photo should look for Adobe DNG Convertor in it's default install location the first time it's run so that the user don't even have to be prompted.

I will take a shot at both. I'll likely will be more successful with the backend changes, but i'll need some sort of UI changes to test it (even if I later scrap it).

martin-marek commented 1 year ago

Perfect. That’s a great idea, but I assume the user will still need to grant some permissions to Burst Photo to access the Applications directory.

Also, I’m sorry in advance for the poor documentation of my code, I might try to clean it up slightly. If you want to chat about any of this in more detail, please feel free to reach me on twitter.

Alex-Vasile commented 1 year ago

I don't have twitter, but i'm about half-way through this. I'll open a PR once I have something that's working. I'll send you an email (off your website) if I need any help in the meantime.

martin-marek commented 1 year ago

Awesome! Alright, please feel free to use the email (or this thread) if you have anything to discuss 🙂