small change to image resizing
This commit is contained in:
@@ -15,7 +15,8 @@ fn to_ascii(char_map: String, image: DynamicImage) -> Vec<Vec<Ascii>> {
|
||||
let mut out: Vec<Vec<Ascii>> = Vec::new();
|
||||
|
||||
for pixel in image.pixels() {
|
||||
let ch = char_map.as_bytes()[((get_color(pixel) as f32-1.0)/255f32 * l) as usize]; //fixme: might break with non-ASCII char_map (ie braille chars, possibly)
|
||||
let ch = char_map.as_bytes()[((get_color(pixel) as f32-1.0)/255f32 * l) as usize];
|
||||
//fixme: might break with non-ASCII char_map (ie braille chars, possibly)
|
||||
str.push(Ascii::new(ch, pixel.2[0], pixel.2[1], pixel.2[2]));
|
||||
|
||||
if pixel.0 == image.width()-1 {
|
||||
|
||||
Reference in New Issue
Block a user