diff options
author | gennyble <gen@nyble.dev> | 2023-10-09 01:27:19 -0500 |
---|---|---|
committer | gennyble <gen@nyble.dev> | 2023-10-09 01:27:19 -0500 |
commit | e52599e25372827fd3cef1433773c5a1b181fd3e (patch) | |
tree | defb472fdf74b3d6c163c0983f52e3454b5d0898 /src/lib.rs | |
parent | 1575e5fd1a358a3c997288998d7b25f87472905d (diff) | |
download | colorsquash-e52599e25372827fd3cef1433773c5a1b181fd3e.tar.gz colorsquash-e52599e25372827fd3cef1433773c5a1b181fd3e.zip |
squash
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 3 |
1 files changed, 2 insertions, 1 deletions
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<u8> { /// # 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; } |