From e52599e25372827fd3cef1433773c5a1b181fd3e Mon Sep 17 00:00:00 2001 From: gennyble Date: Mon, 9 Oct 2023 01:27:19 -0500 Subject: squash --- src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/lib.rs b/src/lib.rs index a404f38..0757a03 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -174,10 +174,11 @@ impl Squasher { /// # Returns /// The new size of the image pub fn map_over(&self, image: &mut [u8]) -> usize { - for idx in 0..image.len() { + for idx in 0..(image.len() / 3) { let rgb_idx = idx * 3; let color = RGB8::new(image[rgb_idx], image[rgb_idx + 1], image[rgb_idx + 2]); let color_index = self.map[color_index(&color)]; + image[idx] = color_index; } -- cgit 1.4.1-3-g733a5