Repository: shssoichiro/oxipng (language: rust)

Issue:
`-o max` is worse than `-o 2` in some cases
version v9.1.2

Test image 1 (1030 Bytes): ![test](https://github.com/user-attachments/assets/f3ed700b-7fa3-4bcc-a7f8-09740cc73900)

```sh
> oxipng -o max -s -Z test.png
test.png: Could not optimize further, no change written

> oxipng -o max -s test.png
test.png: Could not optimize further, no change written

> oxipng -o 2 -s test.png
1028 bytes (0.19% smaller): test.png
```

Test image 2 (147 Bytes): ![RoguelikeRecruitSupportElite0](https://github.com/user-attachments/assets/5e8bae5f-6a2b-4a24-996e-92d6ede21716)

```sh
> oxipng -o max -s -Z test.png
test.png: Could not optimize further, no change written

> oxipng -o max -s test.png
test.png: Could not optimize further, no change written

> oxipng -o 2 -s test.png
140 bytes (4.76% smaller): test.png
```







Discussion / hints:
Further reading: 
https://github.com/ebiggers/libdeflate/issues/241#issue-1420436397
https://github.com/shssoichiro/oxipng/issues/545
https://github.com/shssoichiro/oxipng/issues/568#issuecomment-1764127487
Hi @zzyyyl
As noted in the references above, this is indeed possible on occasion and is actually pretty normal behaviour in the world of lossless data compression. The differences here are a matter of bytes and shouldn't be anything to be concerned about.

As this has come up a couple of times, I'll make a PR to note this in the read me...

Fix patch:
diff --git a/README.md b/README.md
index 007cc7bd..165ed5ed 100644
--- a/README.md
+++ b/README.md
@@ -51,7 +51,7 @@ The most commonly used options are as follows:
 
 - Optimization: `-o 0` through `-o 6` (or `-o max`), lower is faster, higher is better compression.
   The default (`-o 2`) is quite fast and provides good compression. Higher levels can be notably
-  better but generally have increasingly diminishing returns.
+  better* but generally have increasingly diminishing returns.
 - Strip: Used to remove metadata info from processed images. Used via `--strip [safe,all]`.
   Can save a few kilobytes if you don't need the metadata. "Safe" removes only metadata that
   will never affect rendering of the image. "All" removes all metadata that is not critical
@@ -66,7 +66,12 @@ More advanced options can be found by running `oxipng --help`, or viewed [here](
 Some options have both short (`-a`) and long (`--alpha`) forms. Which form you use is just a
 matter of preference. Multiple short options can be combined together, e.g.:
 `-savvo6` is equivalent to to `--strip safe --alpha --verbose --verbose --opt 6`.
-Note that all options are case-sensitive.
+All options are case-sensitive.
+
+\* Note that oxipng is not a brute-force optimizer. This means that while higher optimization levels
+are almost always better or equal to lower levels, this is not guaranteed and it is possible in
+rare circumstances that a lower level may give a marginally smaller output. Similarly, using Zopfli
+compression (`-Z`) is not guaranteed to always be better than without.
 
 ## Git integration via [pre-commit]
 


Test patch: