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, None,
/// Remove specific chunks /// Remove specific chunks
Strip(Vec<String>), 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, Safe,
/// Remove all non-critical chunks except these /// Remove all non-critical chunks except these
Keep(IndexSet<String>), Keep(IndexSet<String>),

View file

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