Skip to content

Commit 00a0348

Browse files
committed
Defer freeing histogram data to remapping
So that an image can be quantized multiple times
1 parent b6c8a2b commit 00a0348

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/hist.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ impl Histogram {
132132
self.reserve(estimated_colors);
133133

134134
self.add_pixel_rows(&image.px, image.importance_map.as_deref(), posterize_bits)?;
135-
image.free_histogram_inputs();
136135

137136
Ok(())
138137
}

src/quant.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ impl QuantizationResult {
8787
return Err(Error::Aborted);
8888
}
8989

90+
image.free_histogram_inputs();
91+
9092
let mut palette = self.palette.clone();
9193
let mut remapped = Box::new(Remapped {
9294
int_palette: Palette { count: 0, entries: [RGBA::default(); MAX_COLORS] },

0 commit comments

Comments
 (0)