diff --git a/Cargo.lock b/Cargo.lock index 56158ad0..002f8862 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,3 +1,5 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. [[package]] name = "adler32" version = "1.0.3" @@ -149,8 +151,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "image" -version = "0.21.0" -source = "git+https://github.com/PistonDevelopers/image?rev=41dfbae#41dfbaecfa0e702eaef61e4dba156e9be5b2f70d" +version = "0.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "lzw 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -257,7 +259,7 @@ dependencies = [ "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", "cloudflare-zlib 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "image 0.21.0 (git+https://github.com/PistonDevelopers/image?rev=41dfbae)", + "image 0.21.2 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "miniz_oxide 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -419,7 +421,7 @@ dependencies = [ "checksum deflate 0.7.19 (registry+https://github.com/rust-lang/crates.io-index)" = "8a6abb26e16e8d419b5c78662aa9f82857c2386a073da266840e474d5055ec86" "checksum either 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c67353c641dc847124ea1902d69bd753dee9bb3beff9aa3662ecf86c971d1fac" "checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" -"checksum image 0.21.0 (git+https://github.com/PistonDevelopers/image?rev=41dfbae)" = "" +"checksum image 0.21.2 (registry+https://github.com/rust-lang/crates.io-index)" = "99198e595d012efccf12abf4abc08da2d97be0b0355a2b08d101347527476ba4" "checksum inflate 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "1cdb29978cc5797bd8dcc8e5bf7de604891df2a8dc576973d71a281e916db2ff" "checksum itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5b8467d9c1cebe26feb08c640139247fac215782d35371ade9a2136ed6085358" "checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" diff --git a/Cargo.toml b/Cargo.toml index 7c90196b..5a71b928 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -55,11 +55,7 @@ cloudflare-zlib = "^0.2.2" [dependencies.image] default-features = false features = ["png_codec"] -#FIXME: Use upstream version when 0.22 is released -#Contains bugfix for issues 167 and 168 -#version = "^0.21.0" -git = "https://github.com/PistonDevelopers/image" -rev = "41dfbae" +version = "^0.21.2" [features] binary = [ diff --git a/src/lib.rs b/src/lib.rs index 226bdf86..70ff06ca 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -863,7 +863,8 @@ fn perform_strip(png: &mut PngData, opts: &Options) { *b"cHRM", *b"gAMA", *b"iCCP", *b"sBIT", *b"sRGB", *b"bKGD", *b"hIST", *b"pHYs", *b"sPLT", ]; - for hdr in &PRESERVED_HEADERS { + let keys: Vec<[u8; 4]> = raw.aux_headers.keys().cloned().collect(); + for hdr in &keys { if !PRESERVED_HEADERS.contains(hdr) { raw.aux_headers.remove(hdr); } diff --git a/tests/files/issue-171.png b/tests/files/issue-171.png new file mode 100644 index 00000000..bf83f52b Binary files /dev/null and b/tests/files/issue-171.png differ diff --git a/tests/regression.rs b/tests/regression.rs index a8dbe045..1b20edee 100644 --- a/tests/regression.rs +++ b/tests/regression.rs @@ -600,6 +600,7 @@ fn issue_159() { } #[test] +#[cfg(target_pointer_width = "64")] fn issue_167() { test_it_converts( "tests/files/issue-167.png", @@ -610,3 +611,15 @@ fn issue_167() { BitDepth::Eight, ); } + +#[test] +fn issue_171() { + test_it_converts( + "tests/files/issue-171.png", + None, + ColorType::Grayscale, + BitDepth::Eight, + ColorType::Grayscale, + BitDepth::Eight, + ); +}