6 ms·
255.0. Everything else makes no sense and is actually dangerous when working with colors. Trust me. :) And when you go from float to 8bit you should dither to
by virtualritz 4mo ago
255.0. Everything else makes no sense and is actually dangerous when working with colors. Trust me. :)
And when you go from float to 8bit you should dither to avoid banding.
If in doubt, error diffusion with a random number between -0.5..=0.5 is fine. 0.5 here is dither_amplitude:
round(255 * input_value + dither_amplitude * random(-1, 1))
See e.g. my dithereens crate: https://crates.io/crates/dithereens https://crates.io/crates/dithereens