Skip to content

Commit 31c6efe

Browse files
committed
show wrong color coords when converting image
1 parent b632407 commit 31c6efe

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/images.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,13 @@ fn write_image<const BPP: u8, const PPB: usize>(
9999
/// Detect all colors used in the image
100100
fn make_palette(img: &RgbaImage) -> Result<Vec<Color>> {
101101
let mut palette = Vec::new();
102-
for pixel in img.pixels() {
102+
for (x, y, pixel) in img.enumerate_pixels() {
103103
let color = convert_color(*pixel);
104104
if !palette.contains(&color) {
105105
if color.is_some() && !DEFAULT_PALETTE.contains(&color) {
106106
bail!(
107-
"found a color not present in the default color palette: {}",
108-
format_color(color)
107+
"found a color not present in the default color palette: {} (at x={x}, y={y})",
108+
format_color(color),
109109
);
110110
}
111111
palette.push(color);

0 commit comments

Comments
 (0)