3 ms·
Noted, I'll do all of these today - but it may require a breaking version update to 0.3.0. It chooses the character by converting the RGB to grayscale and mapp
by RGBCube 3y ago
Noted, I'll do all of these today - but it may require a breaking version update to 0.3.0.
It chooses the character by converting the RGB to grayscale and mapping the 0-255 range to the given charsets length:
let as_grayscale = (pixel[0] as f64 * 0.299) + (pixel[1] as f64 * 0.587) + (pixel[2] as f64 * 0.114);
// TODO: Use alpha channel to determine if pixel is transparent?
let char_index =
((as_grayscale / 255.0) * (self.options.charset.len() as f64 - 1.0)) as usize;
if self.options.invert {
self.options.charset[self.options.charset.len() - 1 - char_index]
} else {
self.options.charset[char_index]
}
- fnordpiglet 3y agoI see so the further into the chat set the darker… thanks!!! It looks really great as a logo when my side project starts up!