Commit graph

639 commits

Author SHA1 Message Date
Josh Holmer
8053211bf4 Version 5.0.0
Some checks failed
deploy / create-windows-binaries (x86_64) (push) Has been cancelled
deploy / create-unix-binaries (macos-latest, x86_64-apple-darwin) (push) Has been cancelled
deploy / create-unix-binaries (ubuntu-latest, x86_64-unknown-linux-musl) (push) Has been cancelled
deploy / deploy (push) Has been cancelled
2021-07-12 00:06:19 -04:00
Josh Holmer
bd432c470d Bump minimum rustc to 1.46, required by crc 2.0 2021-07-11 23:54:29 -04:00
Josh Holmer
44d89ecff4 Fix clippy lints 2021-07-11 23:42:37 -04:00
Josh Holmer
d089176030 Bump dependencies 2021-07-11 23:42:12 -04:00
Moe
40a88f57f7
initial implementation of timestamp preservation #166 (#360)
Closes #166
2021-07-11 23:34:10 -04:00
Alejandro González
491d753edc
Add option to skip grayscale reduction of RGB(A) images (#409)
For RGB(A) images that contain gray colors, this reduction can achieve
significant space savings. However, in the absence of gamma correction
data, some PNG decoders assume more exotic color spaces for grayscale
images instead of the ubiquitous sRGB. This results in gamma
miscorrection, and for the end user this means that colors will look
wrong, like "washed-out". Java's ImageIO class, which is popular in the
JVM world to read PNG files, uses rather unconventional defaults, as
explained in this StackOverflow question: https://stackoverflow.com/questions/31312645/java-imageio-grayscale-png-issue

Gamma miscorrection problems aside, OxiPNG currently tries hard to
reduce RGB(A) images to grayscale, because it expects that reduction to
be quite effective. However, in some cases, OxiPNG generates smaller
PNG files when reducing grasycale RGB(A) images to paletted color than
actual grayscale color. For example, let's say that "~/gray.png" is a
256x256 RGBA image entirely filled with (119, 119, 119, 255) pixels.
OxiPNG, by default, reduces this image to grayscale and achieves a
68.23% decrease:

$ cargo build --release && target/release/oxipng -omax --out ~/out.png ~/gray.png
Processing: /home/user/gray.png
    256x256 pixels, PNG format
    4x8 bits/pixel, RGBA
    IDAT size = 604 bytes
    File size = 661 bytes
Reducing image to 1x4 bits/pixel, Grayscale
Trying: 144 combinations
Found better combination:
    zc = 6  zs = 0  f = 0        153 bytes
    IDAT size = 153 bytes (451 bytes decrease)
    file size = 210 bytes (451 bytes = 68.23% decrease)
Output: /home/user/out.png

However, if the --ng option that this commit adds is used to skip the
grayscale reduction step, OxiPNG reduces to a single color palette
instead, which is much more efficient, achieving a 84.42% decrease:

$ cargo build --release && target/release/oxipng -omax --ng --out ~/out.png ~/gray.png
Processing: /home/alejandro/gray.png
    256x256 pixels, PNG format
    4x8 bits/pixel, RGBA
    IDAT size = 604 bytes
    File size = 661 bytes
Reducing image to 1 bits/pixel, 1 colors in palette
Trying: 144 combinations
Found better combination:
    zc = 3  zs = 3  f = 0        31 bytes
    IDAT size = 31 bytes (573 bytes decrease)
    file size = 103 bytes (558 bytes = 84.42% decrease)
Output: /home/alejandro/out.png

While OxiPNG should arguably be made smarter to better handle these
cases, in the meantime, adding an option to manually skip that grayscale
reduction can't hurt. In fact, it may even help users achieving the most
out of current versions of OxiPNG, and developers reasoning about what
makes a grayscale-like RGB(A) image compress better with a color
palette.

Due to the reasons stated above, this adds a simple "grayscale_reduction"
option to the Options struct, and a "no-grayscale-reduction" command
line switch, that makes OxiPNG not try this problematic grayscale
reduction on RGB(A) images.
2021-07-11 23:21:38 -04:00
Josh Holmer
c4e46b2f3e Update npm packages (used for the benchmark script) 2021-07-11 23:12:32 -04:00
Josh Holmer
06e3feeee1 Use separate file for issue_182 test
Closes #412
2021-07-11 23:10:57 -04:00
Kornel
ea75f6ccc1
Handle files with invalid filters (#410)
The bad filter case is reachable, and can happen when the PNG file is corrupted.
2021-07-11 23:07:18 -04:00
Rémi Lauzier
286aaffa31 small fix 2021-06-24 19:47:21 -04:00
Rémi Lauzier
91a18ebe97 Fix some clippy warnings 2021-06-24 15:57:41 -04:00
Kornel
c4910709d9 Assertions 2021-06-16 19:39:05 -04:00
Kornel
3e996a0f82 Make sure passes clear last line 2021-06-16 19:39:05 -04:00
Kornel
dac408627b bit-vec is too slow for debug mode 2021-06-16 17:37:33 -04:00
Kornel
f8bb4fa637 Fix tests without default features 2021-06-16 17:37:33 -04:00
Kornel
d2cebc3c2d Don't allocate reduced buffer until needed 2021-06-16 17:37:33 -04:00
dependabot[bot]
a38b2fd943
Bump hosted-git-info from 2.5.0 to 2.8.9 (#402)
Bumps [hosted-git-info](https://github.com/npm/hosted-git-info) from 2.5.0 to 2.8.9.
- [Release notes](https://github.com/npm/hosted-git-info/releases)
- [Changelog](https://github.com/npm/hosted-git-info/blob/v2.8.9/CHANGELOG.md)
- [Commits](https://github.com/npm/hosted-git-info/compare/v2.5.0...v2.8.9)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-20 03:45:08 -04:00
Kornel
b6cc8e2414
Optimize unfiltering (#400)
* Clippy lints

* Fewer pushes

* Remove special case for empty last line

* Zip with last line

* Combine bound checks
2021-05-19 15:16:14 -04:00
Kornel
14867c7abc
Clippy lints (#401) 2021-05-19 10:04:31 -04:00
dependabot-preview[bot]
ef3bb7444b Bump image from 0.23.13 to 0.23.14
Bumps [image](https://github.com/image-rs/image) from 0.23.13 to 0.23.14.
- [Release notes](https://github.com/image-rs/image/releases)
- [Changelog](https://github.com/image-rs/image/blob/master/CHANGES.md)
- [Commits](https://github.com/image-rs/image/compare/v0.23.13...v0.23.14)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-03-03 10:45:52 +00:00
dependabot-preview[bot]
6c7c067662 Bump libc from 0.2.86 to 0.2.87
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.86 to 0.2.87.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.86...0.2.87)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-03-02 10:49:32 +00:00
dependabot-preview[bot]
19eff4755b Bump adler from 1.0.1 to 1.0.2
Bumps [adler](https://github.com/jonas-schievink/adler) from 1.0.1 to 1.0.2.
- [Release notes](https://github.com/jonas-schievink/adler/releases)
- [Changelog](https://github.com/jonas-schievink/adler/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jonas-schievink/adler/compare/v1.0.1...v1.0.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-03-01 15:48:51 +00:00
dependabot-preview[bot]
eb7c5be7cc Bump crossbeam-epoch from 0.9.2 to 0.9.3
Bumps [crossbeam-epoch](https://github.com/crossbeam-rs/crossbeam) from 0.9.2 to 0.9.3.
- [Release notes](https://github.com/crossbeam-rs/crossbeam/releases)
- [Changelog](https://github.com/crossbeam-rs/crossbeam/blob/master/CHANGELOG.md)
- [Commits](https://github.com/crossbeam-rs/crossbeam/compare/crossbeam-epoch-0.9.2...crossbeam-epoch-0.9.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-03-01 15:31:13 +00:00
dependabot-preview[bot]
6fe1fb39fb Bump crossbeam-utils from 0.8.2 to 0.8.3
Bumps [crossbeam-utils](https://github.com/crossbeam-rs/crossbeam) from 0.8.2 to 0.8.3.
- [Release notes](https://github.com/crossbeam-rs/crossbeam/releases)
- [Changelog](https://github.com/crossbeam-rs/crossbeam/blob/master/CHANGELOG.md)
- [Commits](https://github.com/crossbeam-rs/crossbeam/compare/crossbeam-utils-0.8.2...crossbeam-utils-0.8.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-26 11:05:09 +00:00
dependabot-preview[bot]
0be3631788 Bump miniz_oxide from 0.4.3 to 0.4.4
Bumps [miniz_oxide](https://github.com/Frommi/miniz_oxide) from 0.4.3 to 0.4.4.
- [Release notes](https://github.com/Frommi/miniz_oxide/releases)
- [Changelog](https://github.com/Frommi/miniz_oxide/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Frommi/miniz_oxide/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-26 10:53:40 +00:00
Kornel
f2e89140ed
Prevent panics in parse_ihdr_header (#392) 2021-02-24 15:48:30 -05:00
dependabot-preview[bot]
f44b5aa2d0 Bump bytemuck from 1.5.0 to 1.5.1
Bumps [bytemuck](https://github.com/Lokathor/bytemuck) from 1.5.0 to 1.5.1.
- [Release notes](https://github.com/Lokathor/bytemuck/releases)
- [Changelog](https://github.com/Lokathor/bytemuck/blob/main/changelog.md)
- [Commits](https://github.com/Lokathor/bytemuck/compare/v1.5.0...v1.5.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-24 20:00:55 +00:00
dependabot-preview[bot]
c6337398df Bump cc from 1.0.66 to 1.0.67
Bumps [cc](https://github.com/alexcrichton/cc-rs) from 1.0.66 to 1.0.67.
- [Release notes](https://github.com/alexcrichton/cc-rs/releases)
- [Commits](https://github.com/alexcrichton/cc-rs/compare/1.0.66...1.0.67)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-24 19:47:22 +00:00
dependabot-preview[bot]
b0c6c4195e Bump crossbeam-utils from 0.8.1 to 0.8.2
Bumps [crossbeam-utils](https://github.com/crossbeam-rs/crossbeam) from 0.8.1 to 0.8.2.
- [Release notes](https://github.com/crossbeam-rs/crossbeam/releases)
- [Changelog](https://github.com/crossbeam-rs/crossbeam/blob/master/CHANGELOG.md)
- [Commits](https://github.com/crossbeam-rs/crossbeam/compare/crossbeam-utils-0.8.1...crossbeam-utils-0.8.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-24 19:30:15 +00:00
dependabot-preview[bot]
5c1e2636c2 Bump crossbeam-epoch from 0.9.1 to 0.9.2
Bumps [crossbeam-epoch](https://github.com/crossbeam-rs/crossbeam) from 0.9.1 to 0.9.2.
- [Release notes](https://github.com/crossbeam-rs/crossbeam/releases)
- [Changelog](https://github.com/crossbeam-rs/crossbeam/blob/master/CHANGELOG.md)
- [Commits](https://github.com/crossbeam-rs/crossbeam/compare/crossbeam-epoch-0.9.1...crossbeam-epoch-0.9.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-24 19:08:21 +00:00
Josh Holmer
76da6b5468 Fix Rust 1.50 clippy error 2021-02-24 13:51:47 -05:00
dependabot-preview[bot]
f8e4a8b170 Bump libc from 0.2.85 to 0.2.86
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.85 to 0.2.86.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.85...0.2.86)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-09 10:55:52 +00:00
dependabot-preview[bot]
aaee0a6a2e Bump image from 0.23.12 to 0.23.13
Bumps [image](https://github.com/image-rs/image) from 0.23.12 to 0.23.13.
- [Release notes](https://github.com/image-rs/image/releases)
- [Changelog](https://github.com/image-rs/image/blob/master/CHANGES.md)
- [Commits](https://github.com/image-rs/image/compare/v0.23.12...v0.23.13)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-05 10:49:02 +00:00
dependabot-preview[bot]
9abb757c31 Bump libc from 0.2.84 to 0.2.85
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.84 to 0.2.85.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.84...0.2.85)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-02 10:46:31 +00:00
dependabot-preview[bot]
da78af20ac Bump libc from 0.2.83 to 0.2.84
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.83 to 0.2.84.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-29 10:30:31 +00:00
dependabot-preview[bot]
dddcffb633 Bump libc from 0.2.82 to 0.2.83
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.82 to 0.2.83.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.82...0.2.83)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-28 10:45:08 +00:00
dependabot-preview[bot]
c73a6b4a83 Bump log from 0.4.13 to 0.4.14
Bumps [log](https://github.com/rust-lang/log) from 0.4.13 to 0.4.14.
- [Release notes](https://github.com/rust-lang/log/releases)
- [Changelog](https://github.com/rust-lang/log/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/log/compare/0.4.13...0.4.14)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-27 10:31:40 +00:00
Kornel
04010978a0 Use optimized copy 2021-01-20 14:33:27 -05:00
Kornel
3163a92594 Ignore broken tRNS 2021-01-20 14:33:27 -05:00
Kornel
53ddd721a7 Reject truncated image data instead of panicking 2021-01-20 14:33:27 -05:00
Kornel
17212477c5 Avoid asserts panicking on broken files 2021-01-20 14:33:27 -05:00
dependabot-preview[bot]
db289689b8 Bump hermit-abi from 0.1.17 to 0.1.18
Bumps [hermit-abi](https://github.com/hermitcore/libhermit-rs) from 0.1.17 to 0.1.18.
- [Release notes](https://github.com/hermitcore/libhermit-rs/releases)
- [Commits](https://github.com/hermitcore/libhermit-rs/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-18 11:29:28 +00:00
dependabot-preview[bot]
b2bb4e1888 Bump rustc_version from 0.3.2 to 0.3.3
Bumps [rustc_version](https://github.com/Kimundi/rustc-version-rs) from 0.3.2 to 0.3.3.
- [Release notes](https://github.com/Kimundi/rustc-version-rs/releases)
- [Commits](https://github.com/Kimundi/rustc-version-rs/compare/v0.3.2...v0.3.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-18 11:16:13 +00:00
dependabot-preview[bot]
618da006a5 Bump bytemuck from 1.4.1 to 1.5.0
Bumps [bytemuck](https://github.com/Lokathor/bytemuck) from 1.4.1 to 1.5.0.
- [Release notes](https://github.com/Lokathor/bytemuck/releases)
- [Changelog](https://github.com/Lokathor/bytemuck/blob/main/changelog.md)
- [Commits](https://github.com/Lokathor/bytemuck/compare/v1.4.1...v1.5.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-14 11:03:21 +00:00
dependabot-preview[bot]
228c43890f Bump rustc_version from 0.3.0 to 0.3.2
Bumps [rustc_version](https://github.com/Kimundi/rustc-version-rs) from 0.3.0 to 0.3.2.
- [Release notes](https://github.com/Kimundi/rustc-version-rs/releases)
- [Commits](https://github.com/Kimundi/rustc-version-rs/compare/v0.3.0...v0.3.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-12 11:04:13 +00:00
dependabot-preview[bot]
f71ed29e96 Bump log from 0.4.11 to 0.4.13
Bumps [log](https://github.com/rust-lang/log) from 0.4.11 to 0.4.13.
- [Release notes](https://github.com/rust-lang/log/releases)
- [Changelog](https://github.com/rust-lang/log/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/log/compare/0.4.11...0.4.13)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-11 11:54:45 +00:00
dependabot-preview[bot]
9d55331980 Bump byteorder from 1.3.4 to 1.4.2
Bumps [byteorder](https://github.com/BurntSushi/byteorder) from 1.3.4 to 1.4.2.
- [Release notes](https://github.com/BurntSushi/byteorder/releases)
- [Changelog](https://github.com/BurntSushi/byteorder/blob/master/CHANGELOG.md)
- [Commits](https://github.com/BurntSushi/byteorder/compare/1.3.4...1.4.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-11 11:41:50 +00:00
dependabot-preview[bot]
0b4221d7f3 Bump stderrlog from 0.5.0 to 0.5.1
Bumps [stderrlog](https://github.com/cardoe/stderrlog-rs) from 0.5.0 to 0.5.1.
- [Release notes](https://github.com/cardoe/stderrlog-rs/releases)
- [Changelog](https://github.com/cardoe/stderrlog-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/cardoe/stderrlog-rs/compare/v0.5.0...v0.5.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-11 11:26:03 +00:00
dependabot-preview[bot]
12f412d915 Bump libc from 0.2.81 to 0.2.82
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.81 to 0.2.82.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.81...0.2.82)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-08 11:08:15 +00:00
dependabot-preview[bot]
7ea5c4d38c Bump const_fn from 0.4.4 to 0.4.5
Bumps [const_fn](https://github.com/taiki-e/const_fn) from 0.4.4 to 0.4.5.
- [Release notes](https://github.com/taiki-e/const_fn/releases)
- [Changelog](https://github.com/taiki-e/const_fn/blob/master/CHANGELOG.md)
- [Commits](https://github.com/taiki-e/const_fn/compare/v0.4.4...v0.4.5)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-06 12:52:24 +00:00