Update safe chunk list

This commit is contained in:
Andrew 2022-11-28 19:19:38 +13:00
parent 37161bf05d
commit a1cd3d33bc
2 changed files with 3 additions and 5 deletions

View file

@ -71,7 +71,7 @@ pub enum Headers {
None,
/// Remove specific chunks
Strip(Vec<String>),
/// Headers that won't affect rendering (all but cHRM, gAMA, iCCP, sBIT, sRGB, bKGD, hIST, pHYs, sPLT)
/// Headers that won't affect rendering (all but cICP, iCCP, sBIT, sRGB, pHYs)
Safe,
/// Remove all non-critical chunks except these
Keep(IndexSet<String>),

View file

@ -857,10 +857,8 @@ fn perform_strip(png: &mut PngData, opts: &Options) {
}
}
Headers::Safe => {
const PRESERVED_HEADERS: [[u8; 4]; 9] = [
*b"cHRM", *b"gAMA", *b"iCCP", *b"sBIT", *b"sRGB", *b"bKGD", *b"hIST", *b"pHYs",
*b"sPLT",
];
const PRESERVED_HEADERS: [[u8; 4]; 5] =
[*b"cICP", *b"iCCP", *b"sBIT", *b"sRGB", *b"pHYs"];
let keys: Vec<[u8; 4]> = raw.aux_headers.keys().cloned().collect();
for hdr in &keys {
if !PRESERVED_HEADERS.contains(hdr) {