Benchmark more codecs - #10001
Benchmark more codecs#10001akx wants to merge 3 commits into
Conversation
fb35993 to
13e2437
Compare
| def test_read_lossless(self) -> None: | ||
| # generated with: cwebp -z 9 hopper.ppm -o hopper_lossless.webp | ||
| with Image.open("Tests/images/hopper_lossless.webp") as webp: | ||
| assert_image_equal(webp, hopper("RGB")) |
There was a problem hiding this comment.
I would have thought that iss634.webp is already a lossless WebP image that is loaded in our test suite.
What is the intention here?
There was a problem hiding this comment.
The intention is to have a losslessly compressed Hopper WEBP example file. 😄
iss634.webp didn't exactly catch my eye to be lossless (it's only referenced in test_file_webp_animated.py without mention of losslessness). But you're right, webpinfo says the animation frames therein are losslessly compressed... but it's an animation, which would probably take a different decoding path, right?
Also, if I'm correct in assuming that .webp was converted from iss634.gif (5fa2794, 2014), it's bound to only have up to 256 colors as GIFs are wont to do.
There was a problem hiding this comment.
... Curiously, ImageMagick counts unique colors differently across various Hoppers. (I've edited the output below a bit so only the maximum %k of each iss634 frame shows up.)
$ magick identify -format "%f=%k\n" Tests/images/hopper.* Tests/images/iss634* 2>/dev/null | sort
hopper.bmp=9684
hopper.bw=255
hopper.dcx=10100
hopper.dds=9684
hopper.fits=255
hopper.gif=256
hopper.ico=224
hopper.jpg=9675
hopper.pcd=112754
hopper.pfm=255
hopper.png=9684
hopper.pnm=10100
hopper.ppm=10100
hopper.psd=9651
hopper.psd=9651
hopper.psd=9651
hopper.qoi=9684
hopper.ras=9684
hopper.rgb=10100
hopper.sgi=10100
hopper.webp=8361
hopper.xbm=2
hopper.xpm=44
iss634.apng=276
iss634.gif=255
iss634.webp=371
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
Refs #9943 (comment) / akx#31.
This extends benchmarks for
test_loadandtest_savefor common formats and options.I hand-picked formats that are likely to be of common modern interest. For instance, ICO/ICNS saving is not covered, because they'd likely spend more time resampling images (which is covered by the resampling tests) than encoding bits.