-
Notifications
You must be signed in to change notification settings - Fork 623
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
Thread panics on EXR containing NAN #2275
Comments
Shorter repro: let img = Rgba32FImage::from_raw(1, 1, vec![1.0 / 0.]).expect("create nan image");
DynamicImage::ImageRgba32F(img).to_rgba8(); |
According to my research, there is no defined operation for how to handle NaN when converting to another format. I can open a PR against my branch if the below behavior is agreed upon. |
Num traits does not support Positive infinites, Negative infinites also, only subnormal numbers are supported. |
Well, in this case the image parses just fine when filtering out NaNs, all other funny values appear to be handled (as this image contains every possible bitrepr) |
Not really, here two immediate fails let img1 = Rgba32FImage::from_raw(1, 1, vec![f32::INFINITY]).expect("create +inf image");
DynamicImage::ImageRgba32F(img1).to_rgba8();
let img2 = Rgba32FImage::from_raw(1, 1, vec![f32::NEG_INFINITY]).expect("create -inf image");
DynamicImage::ImageRgba32F(img2).to_rgba8(); |
let img2 = Rgba32FImage::from_raw(1, 1, vec![0.0]).expect("create any image");
DynamicImage::ImageRgba32F(img2).to_rgba8();
|
let img2 = Rgba32FImage::from_raw(1,1, vec![f32::NEG_INFINITY, f32::INFINITY, f32::NAN, f32::MAX]).expect("create funny image");
dbg!(DynamicImage::ImageRgba32F(img2).to_rgba8()); runs perfectly fine
|
Some EXR files might contain NaNs, e.g., AllHalfValues.exr. Calling
to_rgba8
on such images causes a panic:The text was updated successfully, but these errors were encountered: