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

Added UltraHDR export plugin to generate UltraHDR JPEG images. #502

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

koto
Copy link
Contributor

@koto koto commented Aug 23, 2024

No description provided.

@wpferguson
Copy link
Member

I/m not sure how to use this. I read the header comment and it says I need to provide a jpg image and a gainmap image. I read the ultrahdr_app documentation and it says I need to supply an SDR image and an HDR image.

Could you please provide a workflow that I can use to test this?

Thanks

@koto
Copy link
Contributor Author

koto commented Aug 25, 2024

I/m not sure how to use this. I read the header comment and it says I need to provide a jpg image and a gainmap image. I read the ultrahdr_app documentation and it says I need to supply an SDR image and an HDR image.

The script is using the API-4 encoding variant, i.e. one that expects a JPEG SDR and a JPEG gainmap on input, both of which can be created quite easily in darktable. In hindsight, I probably should make this clear in the UI as well.

Could you please provide a workflow that I can use to test this?

https://discuss.pixls.us/t/manual-creation-of-ultrahdr-images/45004/12

@koto
Copy link
Contributor Author

koto commented Aug 26, 2024

I added a combobox in UI for choosing the encoding variant, so that user knows what the required inputs are. Adding new encoding variants in the future (e.g. SDR and HRD -> UltraHDR) will now be easier.

@koto
Copy link
Contributor Author

koto commented Sep 19, 2024

I changed the plugin to appear as a lib (prevously it was an export storage plugin), cleaning up the UI, adding more descriptions, tooltips, and exposing preferences. I also added support for generating UltraHDR images from SDR + JPEG-XML HDR image pairs.

https://www.youtube.com/watch?v=q5hrx2E7BL4 demonstrates generating UltraHDR JPEGs from SDR + monochrome gainmap pairs.

The biggest challenge for plugin users is that is requires compiling ultrahdr_app from libultrahdr, but I suspect this might eventually change when the library makes it to package managers. Other required binaries (ffmpeg, exiftool) are trivial to obtain.

@wpferguson, LMK if this passes the bar for lua-scripts contrib. If not, I might release it in a separate repo for my own use case.

@wpferguson
Copy link
Member

I'm trying to run this in a completely new environment. I have an SDR raw and I duplicated it and created a gainmap. I select option 1 (SDR + Gainmap) and use original location. I hit the button to run it and it crashes in option 2.

    79.5329 LUA INFO: callback: using encoding variant 1 
    79.5646 LUA ERROR : ...ll/.config/dttest502_ultrahdr/lua/lib/dtutils/string.lua:305: bad argument #1 to 'match' (string expected, got nil)
stack traceback:
	[C]: in ?
	[C]: in function 'string.match'
	...ll/.config/dttest502_ultrahdr/lua/lib/dtutils/string.lua:305: in upvalue '_should_be_sanitized'
	...ll/.config/dttest502_ultrahdr/lua/lib/dtutils/string.lua:316: in function 'lib/dtutils.string.sanitize'
	(...tail calls...)
	...bill/.config/dttest502_ultrahdr/lua/lib/dtutils/file.lua:459: in function 'lib/dtutils.file.check_if_file_exists'
	...bill/.config/dttest502_ultrahdr/lua/contrib/ultrahdr.lua:150: in upvalue 'assert_settings_correct'
	...bill/.config/dttest502_ultrahdr/lua/contrib/ultrahdr.lua:352: in function <...bill/.config/dttest502_ultrahdr/lua/contrib/ultrahdr.lua:343>
	[C]: in ?

I hovered all the widgets looking for tooltips to tell me what is wrong or what I'm missing, but I didn't get enough information to figure it out.

Changed config defaults to require less user input (use_original_directory=TRUE, import_to_darktable=TRUE).
Account for nil values when checking for file existence.
Fixed pref load / saving code defaults.
Metadata file is required in ENCODING_VARIANT_SDR_AUTO_GAINMAP mode.
…ge in a stack will be used, vs the last one).
@koto
Copy link
Contributor Author

koto commented Sep 20, 2024

I fixed the crash, thanks! And many other errors that are obvious when running the plugin on a clean profile 😅

When generating UltraHDRs with gainmaps as inputs, the metadata.cfg file is also required. Previously you had to select one from libultrahdr/examples directory, but now I added the option of just generating it, which will happen on first run. Now the only required setting on fresh install on most distros should be to choose the ultrahdr_app executable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants