top | item 40360991

(no title)

wesamco | 1 year ago

I just realized that the PNG file for the logo hosted on wikimedia, is 232KB! That is a lot, that's unnecessarily large for such a simple logo, so I used vtracer, a raster image to SVG vectorizer, written in Rust, and SVGO, a SVG optimizer, to create the SVG file version of the logo, it is 16KB. a 93.1% improvement in size! (and they look the same)

The 2 commands used:

  > wget 'https://upload.wikimedia.org/wikipedia/commons/d/d5/SUN_microsystems_logo_ambigram.png'
  --2024-05-14 17:33:31--  https://upload.wikimedia.org/wikipedia/commons/d/d5/SUN_microsystems_logo_ambigram.png
  Loaded CA certificate '/etc/ssl/certs/ca-certificates.crt'
  Resolving upload.wikimedia.org (upload.wikimedia.org)... 185.15.59.240, 2a02:ec80:300:ed1a::2:b
  Connecting to upload.wikimedia.org (upload.wikimedia.org)|185.15.59.240|:443... connected.
  HTTP request sent, awaiting response... 200 OK
  Length: 237484 (232K) [image/png]
  Saving to: ‘SUN_microsystems_logo_ambigram.png’
  
  SUN_microsystems_logo_ambigr 100%[=============================================>] 231.92K   821KB/s    in 0.3s
  
  2024-05-14 17:33:32 (821 KB/s) - ‘SUN_microsystems_logo_ambigram.png’ saved [237484/237484]
  
  > vtracer --input SUN_microsystems_logo_ambigram.png --output SUN_microsystems_logo_ambigram.png.svg
  Conversion successful.
  > svgo --precision 1 -o SUN_microsystems_logo_ambigram.png-opt2.svg -i SUN_microsystems_logo_ambigram.png.svg
  Done in 73 ms!
  63.162 KiB - 76% = 15.148 KiB
  >  ls -lah
  total 114M
  drwxr-xr-x 2 wis wis 4.0K May 14 17:34 .
  drwxr-xr-x 4 wis wis 4.0K May 14 17:29 ..
  -rw-r--r-- 1 wis wis 232K Jan 12  2019 SUN_microsystems_logo_ambigram.png
  -rw-r--r-- 1 wis wis  16K May 14 17:34 SUN_microsystems_logo_ambigram.png-opt2.svg
  -rw-r--r-- 1 wis wis  64K May 14 17:33 SUN_microsystems_logo_ambigram.png.svg

Makes you think how much the Wikimedia Foundation can improve the loading experience for users and save in bandwidth costs, if they optimize all the PNG raster images that can/should be optimized, which this file is a prime example of.

discuss

order

npteljes|1 year ago

I think it's up to the users themselves, who sometimes also write bots like this. I have encountered a lot of such effort when clicking on an image, especially on the more popular ones. As an example, check this out: https://commons.wikimedia.org/wiki/File:Tux.svg