-
Notifications
You must be signed in to change notification settings - Fork 24
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
Cannot create a single channel image #171
Comments
thanks for taking the time :) |
If you need a workaround, there are multiple options. You could add a second optional channel and ignore it (very dirty) You can also use dynamic channels, which loads all the channels without the need to specify them, and then you can extract the channel you are interested in.
|
I'm actually trying to write a single channel file (used as a heightmap). For now I'm adding a second channel filled with zeroes :) |
Oh yeah, oopsie. In either case, there is another option: use a custom struct that knows your image data, and make it implement exrs/examples/5a_write_multiple_layers.rs Line 28 in 49fece0
|
I tried this way but it seems very complex for what I need, I'll keep my empty channel for now. |
Yes, if the second channel workaround works for you, it's definitely the nicest code |
Would it solve the other issue to export a type alias |
yes I think it would fix the issue |
Have you tried using the tuple syntax for creating tuples with one value? The Syntax looks like this: let channels = SpecificChannels::build()
.with_channel("H")
.with_pixel_fn(|_| {
(0.0f32,)
}); |
oh yes it works ! thanks I didn't know this syntax ! |
Nice to have it working - but let's keep the issue open, because exrs can be improved nevertheless. |
Description
When using a single channel image, the pixel function should return a (f32) which is as far as I understand simplified into f32 by the compiler. This results in a compilation error :
Reproducing
Environment
The text was updated successfully, but these errors were encountered: