Skip to content

Commit d8cdbc8

Browse files
committed
fix(convert): 修复no-color模式渲染问题
- 修复了在no-color模式下会当分辨率无法被整除时的渲染错误
1 parent 8396660 commit d8cdbc8

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/image/converter.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,13 @@ impl ImageConverter {
219219
let pixel = rgba_img.get_pixel(x, y);
220220
let color = PixelColor::from_channels(pixel.0);
221221
format!("{}▀", color.fg())
222+
} else if let ProcessedImage::NoColor(luma_img) = &self.img{
223+
let pixel = luma_img.get_pixel(x, y);
224+
if pixel.0[0] > 128 {
225+
"▀".to_string()
226+
} else {
227+
" ".to_string()
228+
}
222229
} else {
223230
panic!("Invalid image type")
224231
}

0 commit comments

Comments
 (0)