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

Using webp format to reduce repository size #22

Open
patriciobcs opened this issue Nov 15, 2023 · 2 comments
Open

Using webp format to reduce repository size #22

patriciobcs opened this issue Nov 15, 2023 · 2 comments
Labels
documentation Improvements or additions to documentation enhancement New feature or request good first issue Good for newcomers

Comments

@patriciobcs
Copy link
Contributor

Allowing any type of image format could lead to a heavy repository. I would suggest converting all images to webp (considering the repository data is consumed as a website/slides). A webp images can be as minimum 25% less heavy than a PNG or JPEG (Study).

There is already a File Size comparison section, maybe we could add here the recommendation of using webp. In the same way, maybe adding a makers img-conv command that convert all images non-webp to webp can be a good idea. This can be done with the cwebp package.

As example, in my latest PR I was able to reduce size of some PNG from 10 mb to 900kb.

@Asamartino
Copy link
Collaborator

It's a good point. But if I'm not mistaken, the majority of the images are .svg.
One of the advantage of using .svg is that the image looks great an users see crisp images regardless of their screen sizes.

@nuke-web3
Copy link
Contributor

It's not too hard to inspect the whole set of files here to see 😁

# List svg files and total disk usage
du -csh content/*/*/img/*.svg

# List most other img files and total disk usage we have
du -csh content/*/*/img/{*.jpg,*.png.*.jpeg,*.gif,*.avif,*.webp}
  • about 427 svg - total of 40Mb
  • about 74 other img - total of 38Mb

Overall I would say it would be awesome to only use vector graphics, that were size optimized... but most memes are not in such a form 😛 so we likely should allow for a few rasters in here for fun despite being bulky and lower rez 😁

From https://developers.google.com/speed/webp/ :

WebP lossless images are 26% smaller in size compared to PNGs. WebP lossy images are 25-34% smaller than comparable JPEG images at equivalent SSIM quality index.

It seems like a minor but nice win to have webp over any other format. I agree, if this was a simple make command "lint" to catch and convert (with permission from the user) it would be not too much trouble to request, or even have a CI check to help enforce and perhaps do the conversion automatically efore a squash merge was applied.

Doing this as a manual script once in a while would be OK but bloat the .git object, though not effect the rendered site speed.

@nuke-web3 nuke-web3 added documentation Improvements or additions to documentation enhancement New feature or request good first issue Good for newcomers labels Nov 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants