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

Replace png image format with webp #20

Merged
merged 1 commit into from
Feb 12, 2022
Merged

Replace png image format with webp #20

merged 1 commit into from
Feb 12, 2022

Conversation

dsinn
Copy link
Contributor

@dsinn dsinn commented Feb 12, 2022

While it's possible to make it fall back to older image formats, I don't believe it's worth the effort because webp has been widely supported for a long time: https://caniuse.com/webp

Tested by launching my local server, verifying that no PNG's existed on the pages (in case something in the page generation made git grep and git ls-files fail), and checked the console for 404's. I also eyeballed the differences between the images and they are virtually none.

From the commit message:

  • Used cwebp -near_lossless for everything in src/img so that they're
    virtually indistinguishable from the png's but smaller. This reduced the
    directory size from 6.6 MB to 4.1 MB (~38% smaller).
  • Used cwebp -af for vils-required2.png because it's way too big for
    near-lossless compression and should be converted to HTML anyway.
    I also didn't find any references to it in the history.
  • Left background.jpg alone because I gave up looking for a cwebp option
    that wasn't noticeably blurrier but was smaller than the jpeg.

@dsinn
Copy link
Contributor Author

dsinn commented Feb 12, 2022

Lighthouse estimates a second's worth of savings on load time but this is based on lossless settings. I used -near_lossless to save even more.

Screen Shot 2022-02-11 at 7 41 37 PM

* Used `cwebp -near_lossless` for everything in `src/img` so that they're
  virtually indistinguishable from the png's but smaller. This reduced the
  directory size from 6.6 MB to 4.1 MB (~38% smaller).
* Used `cwebp -af` for `vils-required2.png` because it's way too big for
  near-lossless compression and should be converted to HTML anyway.
  I also didn't find any references to it in the history.
* Left `background.jpg` alone because I gave up looking for a `cwebp` option
  that wasn't noticeably blurrier but was smaller than the jpeg.
@PeterWhiteJavascript PeterWhiteJavascript merged commit 31778ce into PeterWhiteJavascript:master Feb 12, 2022
@dsinn dsinn deleted the webp branch February 13, 2022 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants