Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

png compression choice, decreasing generated png size #824

Open
okias opened this issue Sep 8, 2022 · 1 comment
Open

png compression choice, decreasing generated png size #824

okias opened this issue Sep 8, 2022 · 1 comment

Comments

@okias
Copy link
Contributor

okias commented Sep 8, 2022

Referring to commit 0d06c46 (2012).

For Mesa3D use, when piglit is invoked with --keep-images  we dump one image per trace, which is usually then stored in CI and transferred to the developer computer (while browsing piglit summary). I wonder if it would make sense these days to use level 9 compression for PNG.

When I locally generate a PNG image from 1440x720, let's say with the current option we have a 1.5M file, but when re-compressed with level 9, I get to 1.3MB, which could speed up loading images over the internet on weaker connections (also, developers usually compare changed images, so it's 2x image size).

Another options:
 - recompress images after dumping them in Mesa3D CI 
 - patch apitrace build (currently only Linux) to have level 9 just for Mesa

@okias okias changed the title png size png compression choice, decreasing generated png size Sep 8, 2022
@jrfonseca
Copy link
Member

My recommendation in such circumstances would be to: keep fast png compression, don't recompress anything, but rather generate thumbnails, and generate the HTML reports so that image point to the thumbnail, and href anchors to the full image.

This provides IMO the best of all worlds:

  • image generation (hence test run time) is fast
  • developers can quickly glimpse through all images through thumbnails
  • developers only download the full images they really care about

See https://github.com/apitrace/apitrace/blob/master/scripts/snapdiff.py#L126-L152 for an example of how to achieve, which should be trivial to incorporate into piglit.

If despite thumbnail use, the full images size is still an issue, I'm happy to accept a PR adding a CMake build option to choose the image compression level, or even a runtime option. Default should stay fast though.

  • recompress images after dumping them in Mesa3D CI

FYI, this is trivial to achieve with ImageMagick:

mogrify -alpha off -define png:color-type=6 -define png:compression-level=9 /path/to/*.png

When submitting reference images to a repos, there are other tools out there that can be used to compress PNG even further. But they tend to be very slow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants