Skip to content

Exr: Support reading and writing Luma<f32> images #3016

Description

@RunDevelopment

With ColorType::Luma32F being supported, we can finally have 32-bit single-channel (dynamic) images. However, our exr codec does not support reading and writing such images.

I.e. the following code fails.

let image = ImageBuffer::from_fn(16, 16, |x, y| Luma([(x * y) as f32 / 225.0]));
image.save("test.exr").unwrap();

Description

Add support for both reading and writing single-channel luma exr images. (May be separate PRs.)

The OpenExr specification recommends using Y as the channel name for luma. The encoder should create an image with only a Y channel. The decoder should look for a Y channel and use it. Since exr supports any number and combinations of channels (e.g. R+G+B+Y is possible), the decoder should prefer RGB/RGBA over pure luma.

The decoder implementation should be tested using a .exr file containing a Y channel. The encoder implementation should be tested using a roundtrip (=generate some image, encode, decode, compare decoded image to starting image).

Luma + Alpha encoding and decoding should not be a goal right now.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issuekind: new featuresAn operation that does not exist yet, add draft tag if appropriatetopic: formatsTowards better encoding format coverage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions