Add OpenEXR support for single-channel Luma32F images - #3100
Closed
ChrisJr404 wants to merge 1 commit into
Closed
Conversation
Read and write single-channel luminance EXR images through the Y channel, as recommended by the OpenEXR spec. The decoder prefers RGB(A) layers and falls back to a Y-only layer, decoding it as Luma32F. The encoder writes Luma32F buffers to a single Y channel. Closes image-rs#3016
Member
|
https://github.com/image-rs/organization/blob/main/CONTRIBUTING.md#llm-policy Given that you made >30 PRs to >15 repos yesterday and the LLM-speak in your PR description, I'm going to assume an LLM was involved substantually. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3016.
Now that
ColorType::Luma32Fexists, this teaches the OpenEXR codec to read and write single-channel 32-bit float luma images, which previously failed.Behavior
Following the OpenEXR channel-naming recommendation, luma is stored in a channel named
Y.Y-only layer, which is decoded asLuma32F. When a file contains both RGB andYchannels, RGB is still preferred.ExtendedColorType::L32Fbuffers are written to a singleYchannel.So the example from the issue now works:
Luma + alpha is intentionally left out of scope, as noted in the issue.
Tests
Added
roundtrip_luma(generate aLuma32Fimage, encode, decode, compare), mirroring the existingroundtrip_rgb/roundtrip_rgbatests. The decoder is exercised on a realY-channel.exrproduced by the new encoder path. All existing OpenEXR tests still pass, confirming RGB/RGBA decoding is unchanged.cargo test --features exr,hdr --lib codecs::openexr— 6 passed.cargo clippy --features exr— no warnings.cargo fmt --check— clean.