We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 310de9d commit e710501Copy full SHA for e710501
src/image/reducer.rs
@@ -79,9 +79,9 @@ impl Reducer {
79
}
80
81
*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,
+ ((r_acc / cnt.max(1)) * 65535 / (255 * 255)).min(u16::MAX as _) as u16,
+ ((g_acc / cnt.max(1)) * 65535 / (255 * 255)).min(u16::MAX as _) as u16,
+ ((b_acc / cnt.max(1)) * 65535 / (255 * 255)).min(u16::MAX as _) as u16,
85
);
86
87
0 commit comments