Skip to content

Uhdr write - #5335

Open
mugulmd wants to merge 4 commits into
AcademySoftwareFoundation:mainfrom
mugulmd:uhdr-write
Open

Uhdr write#5335
mugulmd wants to merge 4 commits into
AcademySoftwareFoundation:mainfrom
mugulmd:uhdr-write

Conversation

@mugulmd

@mugulmd mugulmd commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Assisted-by: claude-code / opus-5

Description

Related to #5229.

In its current state, OpenImageIO only supports reading Ultra HDR images, and does not support writing such images.

This feature has been requested because it enables converting an HDR image from specialized formats such as OpenEXR to widely-supported and easily displayable/exchangeable JPEG files.

libultrahdr (the codec we use for Ultra HDR) has plenty of options but we only use a restricted subset for simplicity, which leads to the following constraints:

  • incoming image data must be half or float
  • oiio:ColorSpace must be one of lin_rec709_scene, lin_p3d65_scene, lin_rec2020_scene because it needs a corresponding "Ultra HDR color gamut".

Also, in order to trigger the Ultra HDR output path, the incoming image must have the jpeg:ultrahdr metadata set to any non-zero integer.

Tests

3 tests have been added to jpeg-ultrahdr:

  • synthesize an Ultra HDR image, write it, then ensure reading it back succeeds
  • ensure writing an Ultra HDR image with integer data fails
  • ensure writing an Ultra HDR image with an unsupported color space fails.

Checklist:

  • I have read the guidelines on contributions and code review procedures.
  • I have read the Policy on AI Coding Assistants
    and if I used AI coding assistants, I have an Assisted-by: TOOL / MODEL
    line in the pull request description above.
  • I have updated the documentation if my PR adds features or changes
    behavior.
  • I am sure that this PR's changes are tested in the testsuite.
  • I have run and passed the testsuite in CI before submitting the
    PR, by pushing the changes to my fork and seeing that the automated CI
    passed there. (Exceptions: If most tests pass and you can't figure out why
    the remaining ones fail, it's ok to submit the PR and ask for help. Or if
    any failures seem entirely unrelated to your change; sometimes things break
    on the GitHub runners.)
  • My code follows the prevailing code style of this project and I
    fixed any problems reported by the clang-format CI test.
  • If I added or modified a public C++ API call, I have also amended the
    corresponding Python bindings. If altering ImageBufAlgo functions, I also
    exposed the new functionality as oiiotool options.

@lgritz lgritz added enhancement Improvement of existing/working features. file formats Image file formats, ImageInput, ImageOutput labels Aug 2, 2026
@lgritz

lgritz commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Hi, @mugulmd, just a reminder that this is still marked as a draft, needs a DCO, and has some clang-format fixes. I think that the "hobbled" failure is unrelated and has been separately fixed, should be fixed if you rebase this on top of the current main.

@mugulmd

mugulmd commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

Hi @lgritz yep sorry I just reached the stage of "this works on my machine, let's make a draft PR and finish this later" and I've been procrastinating a little bit 😅 I have some spare time in the days to come, I'll finish this properly!

Signed-off-by: Loïc Vital <mugulmotion@gmail.com>
… flags

Signed-off-by: Loïc Vital <mugulmotion@gmail.com>
Signed-off-by: Loïc Vital <mugulmotion@gmail.com>
Signed-off-by: Loïc Vital <mugulmotion@gmail.com>
@mugulmd
mugulmd marked this pull request as ready for review August 10, 2026 20:59
@lgritz

lgritz commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

Can you rebase on top of current main to fix the apparent conflict in buildinplugins.rst?

I wonder if the conflict is related to the several places where you seem to have changed whitespace, probably something your editor or pre-commit hooks did automatically?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improvement of existing/working features. file formats Image file formats, ImageInput, ImageOutput

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants