You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello. I have been implementing a 3D renderer for fun, and one often has to manipulate images and pixels in f32, and convert them to u32 at the very end when rendering. However, I find myself constantly making awkward casts everywhere, and I was wondering if it was possible to convert from let's say Rgba<f32> to Rgba<u8> somehow? I think it is possible between images using the DynamicImage type and its conversion functions, but I didn't find a straightforward way of doing the same between pixels. Is there any way to do this? If not, why not?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello. I have been implementing a 3D renderer for fun, and one often has to manipulate images and pixels in f32, and convert them to u32 at the very end when rendering. However, I find myself constantly making awkward casts everywhere, and I was wondering if it was possible to convert from let's say
Rgba<f32>
toRgba<u8>
somehow? I think it is possible between images using theDynamicImage
type and its conversion functions, but I didn't find a straightforward way of doing the same between pixels. Is there any way to do this? If not, why not?Thanks beforehand,
Emmanuel
Beta Was this translation helpful? Give feedback.
All reactions