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

First example has uncommon sample types (Krita 4.4.5 and RenderDoc 1.18 cannot open) #153

Open
curldivergence opened this issue Apr 19, 2022 · 9 comments
Labels
bug Something isn't working

Comments

@curldivergence
Copy link

Description

Hi, I've tried running a couple of examples, including the first one from README, but unfortunately, I'm unable to view the generated files neither with Krita nor with RenderDoc. The error messages I'm facing look like this (respectively):

image
image

Is there any chance this is a known issue, or maybe I'm doing something wrong? :)

Thank you!

Reproducing

  1. Run the trivial example from README:
fn main() {
    // write a file with 16-bit alpha and 32-bit color precision
    exr::prelude::write_rgba_file(
        "tests/images/out/minimal_rgb.exr",
        2048, 2048, // write an image with 2048x2048 pixels
        |x,y| ( // generate (or lookup in your own image) an f32 rgb color for each of the 2048x2048 pixels
                x as f32 / 2048.0, // red
                y as f32 / 2048.0, // green
                1.0 - (y as f32 / 2048.0), // blue
                f16::from_f32(0.8) // 16-bit alpha
        )
    ).unwrap();
}
  1. Try to open the generated .exr with Krita or RenderDoc
  2. Observe the error

Environment

  • Operating System: Windows 11
  • CPU Model: Intel(R) Core(TM) i7-9700F
  • EXRS Version used: 1.4.2
@curldivergence curldivergence added the bug Something isn't working label Apr 19, 2022
@johannesvollmer
Copy link
Owner

johannesvollmer commented Apr 19, 2022

Hi, thanks for taking the time. It's not a known issue.

We only know that Affinity Designer and blender can open the images. Let's have a look at Krita and RenderDoc

Krita seems to use openexr 2.5.5 (February 12, 2021)
Assuming that Krita 4.4.5 already uses this version (might want to check though)

@johannesvollmer
Copy link
Owner

johannesvollmer commented Apr 19, 2022

There is a few things we can try in exrs when saving an image. For example, changing the compression method, or the difference between rgb and rgba, or a custom channel set. Also we should try to read an exr file which was exported from Krita and have a look at the contents of that file

@johannesvollmer
Copy link
Owner

johannesvollmer commented Apr 20, 2022

Some observations:

  • Exported exrs rgba image can be opened with affinity
  • Exporting that file from Affinity and opening in Krita works only if I remove the alpha channel in Affinity (otherwise it is only white, maybe Krita or Affinity got confused by the channel naming)
  • Exporting that image from Krita and printing the meta data reveals no special or suspicious meta data (not any at all, basically)

@curldivergence
Copy link
Author

Hi, thanks a lot for your efforts :) And sorry, I've missed your question about used Krita/RD versions. To be safe, I've updated both of them to the latest versions (5.0.5 and 1.19, respectively), but the results are the same. Please let me know if you need any other input from me. Thank you!

@smaragden
Copy link

First off, just a comment on the example in the readme.
If you just want to test the example, there are 2 issues.
First, the code assumes that the relative folder tests/images/out/ exists.
Second, f16is not fully qualified or brought into scope.
So for a test that works out of the box, I would suggest the following changes to the example:

use exr::prelude::*;

fn main() {
    // write a file with 16-bit alpha and 32-bit color precision
    write_rgba_file(
        "minimal_rgb.exr",
        2048, 2048, // write an image with 2048x2048 pixels
        |x,y| ( // generate (or lookup in your own image) an f32 rgb color for each of the 2048x2048 pixels
                x as f32 / 2048.0, // red
                y as f32 / 2048.0, // green
                1.0 - (y as f32 / 2048.0), // blue
                f16::from_f32(0.8) // 16-bit alpha
        )
    ).unwrap();
}

Or just fully qualify exrs::prelude::f16.

Now for the issue with the generated exr.
It seems like Krita assumes that all channels are the same type.
Krita opens the generated file fine as long as all channels are either f32or f16.

This is obviously a limitation in Krita and probably other software as well and should be reported to the Krita developers.

With that said and to make the first impression better for users trying out this crate, I suggest that the example works out of the box with the above changes.
And that it generates a simpler more widely compatible exr by unifying the datatype for the channels.

Other than that, this is a great crate and I appreciate your work @johannesvollmer !

@johannesvollmer
Copy link
Owner

johannesvollmer commented Apr 21, 2022

Excellent work! Agreeing in all of your points. Thank you Smaragden.

@johannesvollmer
Copy link
Owner

How would you go about the missing directory? Would it solve the issue to simply create the directory if it does not exist yet?

Also, I presume it would probably better to write into some folder inside the examples directory, instead of the test folder. What do you think

@smaragden
Copy link

Like in my above exemple. Just let it write the file to the current directory.

@johannesvollmer
Copy link
Owner

johannesvollmer commented Apr 21, 2022

Yeah why not, for simplicity's sake

@johannesvollmer johannesvollmer changed the title Krita 4.4.5 and RenderDoc 1.18 cannot open a trivial EXR file generated by the library example First example has uncommon sample types (Krita 4.4.5 and RenderDoc 1.18 cannot open) Jan 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants