Skip to content

Commit 130e04d

Browse files
committed
Lowest qualities limit number of colors
1 parent 06cdae3 commit 130e04d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,9 @@ impl Writer {
411411
100 // the first frame is too important to ruin it
412412
};
413413
liq.set_quality(0, quality)?;
414+
if settings.s.quality < 50 {
415+
liq.set_max_colors(u32::from(settings.s.quality * 2).max(16).next_power_of_two())?;
416+
}
414417
let (buf, width, height) = image.into_contiguous_buf();
415418
let mut img = liq.new_image(buf, width, height, 0.)?;
416419
// only later remapping tracks which area has been damaged by transparency

0 commit comments

Comments
 (0)