Always fix palette even if it would be larger
This commit is contained in:
parent
a30ee05ca8
commit
1ddab42edb
1 changed files with 3 additions and 2 deletions
|
|
@ -43,8 +43,9 @@ pub fn reduced_palette(png: &PngImage, optimize_alpha: bool) -> Option<PngImage>
|
||||||
let data = if did_change {
|
let data = if did_change {
|
||||||
// Reassign data bytes to new indices
|
// Reassign data bytes to new indices
|
||||||
png.data.iter().map(|b| byte_map[*b as usize]).collect()
|
png.data.iter().map(|b| byte_map[*b as usize]).collect()
|
||||||
} else if condensed.len() < palette.len() {
|
} else if condensed.len() != palette.len() {
|
||||||
// Data is unchanged but palette will be truncated
|
// Data is unchanged but palette is different size
|
||||||
|
// Note the new palette could potentially be larger if the original had a missing entry
|
||||||
png.data.clone()
|
png.data.clone()
|
||||||
} else {
|
} else {
|
||||||
// Nothing has changed
|
// Nothing has changed
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue