parent
7594ec632b
commit
918c52eed8
4 changed files with 22 additions and 4 deletions
|
|
@ -1,3 +1,6 @@
|
|||
### Version 2.1.8
|
||||
- Fix non-standard sBIT headers in other code locations ([#153](https://github.com/shssoichiro/oxipng/issues/153))
|
||||
|
||||
### Version 2.1.7
|
||||
- 80x faster palette reduction ([#150](https://github.com/shssoichiro/oxipng/pull/150))
|
||||
- Optimize RGB to palette conversion ([#148](https://github.com/shssoichiro/oxipng/pull/148))
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ pub fn reduce_alpha_channel(png: &mut PngData, channels: u8) -> Option<Vec<u8>>
|
|||
if let Some(sbit_header) = png.aux_headers.get_mut(b"sBIT") {
|
||||
// Some programs save the sBIT header as RGB even if the image is RGBA.
|
||||
// Only remove the alpha channel if it's actually there.
|
||||
if sbit_header.len() == channels as usize {
|
||||
if sbit_header.len() == 4 {
|
||||
sbit_header.pop();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ pub fn reduce_rgba_to_grayscale_alpha(png: &mut PngData) -> bool {
|
|||
}
|
||||
|
||||
if let Some(sbit_header) = png.aux_headers.get_mut(b"sBIT") {
|
||||
assert_eq!(sbit_header.len(), 4);
|
||||
assert!(sbit_header.len() >= 3);
|
||||
sbit_header.remove(1);
|
||||
sbit_header.remove(1);
|
||||
}
|
||||
|
|
@ -170,8 +170,11 @@ pub fn reduce_color_to_palette(png: &mut PngData) -> bool {
|
|||
}
|
||||
|
||||
if let Some(sbit_header) = png.aux_headers.get_mut(b"sBIT") {
|
||||
assert_eq!(sbit_header.len(), 4);
|
||||
sbit_header.pop();
|
||||
// Some programs save the sBIT header as RGB even if the image is RGBA.
|
||||
// Only remove the alpha channel if it's actually there.
|
||||
if sbit_header.len() == 4 {
|
||||
sbit_header.pop();
|
||||
}
|
||||
}
|
||||
|
||||
let mut palette_vec = vec![RGBA8::new(0, 0, 0, 0); palette.len()];
|
||||
|
|
|
|||
|
|
@ -560,3 +560,15 @@ fn issue_141() {
|
|||
BitDepth::Eight,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn issue_153() {
|
||||
test_it_converts(
|
||||
"tests/files/issue-153.png",
|
||||
None,
|
||||
ColorType::RGBA,
|
||||
BitDepth::Eight,
|
||||
ColorType::Indexed,
|
||||
BitDepth::Eight,
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue