Commit graph

659 commits

Author SHA1 Message Date
Alejandro González
9479f5f4f5 Version 6.0.1
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
2022-09-07 11:50:33 -04:00
Alejandro González
9aa27a75bd Bump dependencies. Fix Zopfli mode generating corrupt images sometimes 2022-09-07 11:50:33 -04:00
Josh Holmer
5fe6350c68
Update CHANGELOG.md 2022-09-05 13:07:05 -04:00
Josh Holmer
5810ae4f49
Version 6.0.0 (#448)
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
2022-09-05 13:05:52 -04:00
Alejandro González
84bbec0666
Add initial support for changing Zopfli iterations (#446)
* Update and optimize dependencies

These changes update the dependencies to their latest versions, fixing
some known issues that prevented doing so in the first place.

In addition, the direct dependency on byteorder was dropped in favor
of stdlib functions that have been stabilized for some time in Rust, and
the transitive dependency on chrono, pulled by stderrlog, was also
dropped, which had been affected by security issues and improperly
maintained in the past:

- https://github.com/cardoe/stderrlog-rs/issues/31
- https://www.reddit.com/r/rust/comments/ts84n4/chrono_or_time_03/

* Run rustfmt

* Bump MSRV to 1.56.1

Updating to this patch version should not be cumbersome for end-users,
and it is required by a transitive dependency.

* Bump MSRV to 1.57.0

os_str_bytes requires it.

* Add initial support for changing Zopfli iterations

PR https://github.com/shssoichiro/oxipng/pull/445 did some dependency
updates, which included using the latest zopfli version. The latest
version of this crate exposes new options in its API that allow users to
choose the desired number of Zopfli compression iterations, which
may greatly affect execution time. In fact, other optimizers such as
zopflipng dynamically select this number depending on the input file
size (see: https://github.com/shssoichiro/oxipng/issues/414).

As a first step towards making OxiPNG deal with Zopfli better, let's add
the necessary options for libraries to be able to choose the number of
iterations. This number is still fixed to 15 as before when using the
CLI.

* Fix Clippy lint

Co-authored-by: Josh Holmer <jholmer.in@gmail.com>
2022-09-05 12:50:13 -04:00
Alejandro González
94ba8b70b3
Update and optimize dependencies (#445)
* Update and optimize dependencies

These changes update the dependencies to their latest versions, fixing
some known issues that prevented doing so in the first place.

In addition, the direct dependency on byteorder was dropped in favor
of stdlib functions that have been stabilized for some time in Rust, and
the transitive dependency on chrono, pulled by stderrlog, was also
dropped, which had been affected by security issues and improperly
maintained in the past:

- https://github.com/cardoe/stderrlog-rs/issues/31
- https://www.reddit.com/r/rust/comments/ts84n4/chrono_or_time_03/

* Run rustfmt

* Bump MSRV to 1.56.1

Updating to this patch version should not be cumbersome for end-users,
and it is required by a transitive dependency.

* Bump MSRV to 1.57.0

os_str_bytes requires it.
2022-09-05 12:37:47 -04:00
dependabot[bot]
e5d1c7dbaa Bump thread_local from 1.0.1 to 1.1.4
Bumps [thread_local](https://github.com/Amanieu/thread_local-rs) from 1.0.1 to 1.1.4.
- [Release notes](https://github.com/Amanieu/thread_local-rs/releases)
- [Commits](https://github.com/Amanieu/thread_local-rs/compare/v1.0.1...1.1.4)

---
updated-dependencies:
- dependency-name: thread_local
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-06 08:56:21 +00:00
dependabot[bot]
9b14628364 Bump ansi-regex from 6.0.0 to 6.0.1
Bumps [ansi-regex](https://github.com/chalk/ansi-regex) from 6.0.0 to 6.0.1.
- [Release notes](https://github.com/chalk/ansi-regex/releases)
- [Commits](https://github.com/chalk/ansi-regex/compare/v6.0.0...v6.0.1)

---
updated-dependencies:
- dependency-name: ansi-regex
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-06 08:41:53 +00:00
Matt Riggott
703a25efad Update stderrlog dependency to v0.5.1
Oxipng has an optional dependency on stderrlog, which itself has a
dependency on thread_local. Versions of thread_local < 1.1.4 have a
vulnerability caused by a data race in Iter and IterMut. Updating to
stderrlog v0.5.1 ensures that Oxipng uses a patched version of
thread_local.

https://rustsec.org/advisories/RUSTSEC-2022-0006.html
2022-07-05 10:28:12 -04:00
Josh Holmer
17f5cc36ca Fix clippy lints 2022-07-05 10:05:06 -04:00
carbotaniuman
9054b2d947 Add check option 2022-05-07 23:48:06 -04:00
Rémi Lauzier
7ffbe1fb78 Update dependency and replace deprecated function 2022-03-14 09:21:22 -04:00
Adam Johnson
acdd66b4c5
Add pre-commit hook declaration (#431)
Fixes #429.
2022-01-14 21:55:48 -05:00
Josh Holmer
faf10c64a9 Bump edition to 2021, along with min rust version 2022-01-12 11:50:33 -05:00
Josh Holmer
ece9787822 Bump all dependencies 2022-01-12 02:47:59 -05:00
Josh Holmer
7f6fe08b06 Format cargo.toml using prettier 2022-01-12 02:41:13 -05:00
Josh Holmer
f5053f65bb Add min rust version to Cargo.toml 2022-01-12 02:40:51 -05:00
Josh Holmer
c888142bcb Version 5.0.1
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-11-15 11:42:06 -05:00
Josh Holmer
bc0d673af0 Fix a hard error in clippy 2021-11-15 11:41:40 -05:00
Nino Burini
2d16819cbf
apply_preset_5 and apply_preset_6 to set correct compression levels. (#425)
The for loop in apply_preset_5 was not including 9.
apply_preset_6 now builds now calls apply_preset_4 instead of
apply_preset_5, and adds all compression levels from 1 to 9.

Co-authored-by: Nino Burini <nburini@jabra.com>
2021-11-15 11:17:52 -05:00
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