Skip to content

Commit e710501

Browse files
committed
fix(image): Fix reducer color scale
1 parent 310de9d commit e710501

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/image/reducer.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ impl Reducer {
7979
}
8080

8181
*value = Color16::new(
82-
(r_acc / cnt.max(1)).max(0).min(u16::MAX as _) as u16,
83-
(g_acc / cnt.max(1)).max(0).min(u16::MAX as _) as u16,
84-
(b_acc / cnt.max(1)).max(0).min(u16::MAX as _) as u16,
82+
((r_acc / cnt.max(1)) * 65535 / (255 * 255)).min(u16::MAX as _) as u16,
83+
((g_acc / cnt.max(1)) * 65535 / (255 * 255)).min(u16::MAX as _) as u16,
84+
((b_acc / cnt.max(1)) * 65535 / (255 * 255)).min(u16::MAX as _) as u16,
8585
);
8686
}
8787
}

0 commit comments

Comments
 (0)