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

Losslessly compress PNGs #780

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

hugovk
Copy link
Contributor

@hugovk hugovk commented Jul 4, 2024

Some of the images on the website are much larger than they need to be, for example one of the of the sponsor logo images is 5692x3200 but displayed at 250x120!

All the sizes:

  • 400x400
  • 1014x514
  • 1024x373
  • 1024x373
  • 1164x638
  • 1368x700
  • 1394x718
  • 1568x830
  • 1572x906
  • 1576x888
  • 1634x910
  • 1686x888
  • 1698x864
  • 1728x972
  • 1766x976
  • 1792x1022
  • 1800x1200
  • 1904x1520
  • 1910x760
  • 2030x1138
  • 2133x1200
  • 2133x1422
  • 2317x1434
  • 2480x3508
  • 2480x3508
  • 2483x3508
  • 2500x1200
  • 2662x1576
  • 3279x1785
  • 3453x2177
  • 3508x2481
  • 3508x2481
  • 5692x3200
  • 6461x3634
  • 6461x3634

These should really be resized to something closer to their display size (the same applies to WEBP images). I've not done that here.

Instead, I've losslessly compressed the PNGs https://github.com/shssoichiro/oxipng (it's a multithreaded version of optiPNG to reduce their total size by about 15% from 93 MB to 79 MB, using the command git ls-files "*.png" | xargs oxipng -o max --strip all

24619 bytes (19.17% smaller): public/favicon.png
44673 bytes (29.65% smaller): public/img/eps-logo.png
499687 bytes (35.39% smaller): src/images/rooms/level-5-foyer.png
87298 bytes (18.24% smaller): public/social-card.png
338084 bytes (48.44% smaller): src/images/rooms/forum.png
118658 bytes (11.87% smaller): src/content/sponsors/kraken.png
464113 bytes (52.19% smaller): src/images/rooms/liffey-hall-1.png
155930 bytes (20.81% smaller): public/social_card_remote.png
219563 bytes (48.57% smaller): src/images/rooms/ground-floor-foyer.png
553604 bytes (53.35% smaller): src/images/rooms/level-1-foyer.png
419777 bytes (51.24% smaller): src/images/rooms/liffey-a.png
178127 bytes (46.36% smaller): src/images/rooms/level-2-foyer.png
7878246 bytes (14.14% smaller): src/content/deadlines/hall_rotated.png
41995 bytes (65.67% smaller): src/content/sponsors/packt.png
494986 bytes (52.66% smaller): src/images/rooms/liffey-hall-2.png
434471 bytes (13.21% smaller): src/images/rooms/liffey-meeting-room-2.png
486164 bytes (52.58% smaller): src/images/rooms/liffey-boardroom-3.png
406887 bytes (51.34% smaller): src/images/rooms/liffey-boardroom-4.png
357845 bytes (51.47% smaller): src/images/rooms/wicklow-hall-1.png
1046941 bytes (42.93% smaller): src/images/rooms/level-3-foyer.png
44905 bytes (29.35% smaller): public/img/eps-logo-white.png
55288 bytes (72.30% smaller): src/content/pages/images/accessibility-references.png
239026 bytes (19.63% smaller): public/sponsor-swag/googlecloud-swag.png
268126 bytes (49.05% smaller): src/images/rooms/wicklow-hall-2.png
280206 bytes (49.28% smaller): src/images/rooms/ecocem.png
1359849 bytes (6.36% smaller): src/content/pages/images/accessibility-first-floor-map.png
413331 bytes (31.50% smaller): src/content/pages/images/accessibility-second-floor-map.png
1450394 bytes (25.70% smaller): src/content/pages/images/accessibility-map.png
752276 bytes (15.28% smaller): public/sponsor-swag/numberly-swag-0.png
2868132 bytes (13.47% smaller): src/content/pages/images/sprints-collage24.png
1071445 bytes (7.28% smaller): src/content/pages/images/accessibility-ground-floor-map.png
816263 bytes (11.23% smaller): src/content/pages/images/accessibility-parking-map.png
5650859 bytes (14.16% smaller): public/sponsor-swag/numberly-swag-1.png
26861661 bytes (7.31% smaller): src/images/cards/volunteers-23.png
26861661 bytes (7.31% smaller): src/content/deadlines/volunteers-24.png

Copy link

vercel bot commented Jul 4, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ep2024 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 4, 2024 10:23am

@patrick91
Copy link
Member

@hugovk mmh, I don't think this would change much, since we are using Astro to optimise the images

Not sure why it is not resizing the sponsor ones well though 🤔

@patrick91
Copy link
Member

should be fixed after merging this: #781

@patrick91
Copy link
Member

I think we could close this, I don't think we need to optimise the source images, unless we want to save space on the git repo (but then we'd need to purge the previous images from the history too), what do you think?

@hugovk
Copy link
Contributor Author

hugovk commented Jul 4, 2024

Larger files are still being served, even after merging #781.

I checked two files from the website (favicon.png and social-card.png) and they're still the bigger sizes (30k and 104k) rather than the smaller ones in this PR (24K and 85k).

@patrick91
Copy link
Member

@hugovk which ones?

for favicon and social, we can update them 😊

@hugovk
Copy link
Contributor Author

hugovk commented Jul 4, 2024

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.

2 participants