Skip to content

Compress large PNGs #1057

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

Merged
merged 1 commit into from
Jun 5, 2025
Merged

Compress large PNGs #1057

merged 1 commit into from
Jun 5, 2025

Conversation

plemarquand
Copy link
Contributor

@plemarquand plemarquand commented Jun 5, 2025

Takes a pass at compressing the largest .png images across the site.

As Sarunas pointed out in the forums (https://forums.swift.org/t/redesigned-swift-org-is-now-live/80296/13), the images for the landing page are quite large, where hero-bottom.png clocks in at 2302kb and swoop-0.png is 1611kb.

Run pngquant over the largest images in the site with slightly lossy compression to improve the first load experience of the site.

pngquant was run with the following to compress and replace images in place:
pngquant --quality=45-60 -f --ext .png **/*.png

While this is a lossy compression, visual inspection in the PR diff view doesn't show major compression artifacts or colour distortion.

Some results:
swoop-0.png: 1611kb -> 369kb (77% reduction)
hero-bottom.png: 2302kb -> 544kb (76% reduction)

PNG retains a broad browser compatibility so it was favoured over using a new more compressible format like .webp or .avif

Takes a pass at compressing the largest `.png` images across the site.

As Sarunas pointed out in the forums (https://forums.swift.org/t/redesigned-swift-org-is-now-live/80296/13),
the images for the landing page are quite large, where hero-bottom.png
clocks in at 2302kb and swoop-0.png is 1611kb.

Run `pngquant` over the largest images in the site with slightly lossy
compression to improve the first load experience of the site.

`pngquant` was run with the following to compress and replace images in
place:
`pngquant --quality=45-60 -f --ext .png **/*.png`

Some results:
`swoop-0.png`: 1611kb -> 369kb (77% reduction)
`hero-bottom.png`: 2302kb -> 544kb (76% reduction)

PNG retains a broad browser compabitility so it was favoured over using
a new more compressable format like `.webp` or `.avif`
@shahmishal shahmishal merged commit 7e91935 into swiftlang:main Jun 5, 2025
3 checks passed
@vsarunas
Copy link

vsarunas commented Jun 5, 2025

Yay! 2,384KB to 1,013KB, 2.35x smaller for the main page! So that is 2 seconds faster to download and render!

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.

3 participants