Tech

Entries

Google Photos - It's Bigger on the Inside

/attachments/tech/google-photos-tardis_hu9715966894441480354.webp
Christmas family IT support ticket involving Google Photos and infinity. — 2024-12-25

47% Space Savings Migrating from JPG to WebP

Today I converted all images on this hugo site, mostly travel photographs, from, mostly, JPEG to WebP because it seems like a widely supported format that is more efficient and covers both lossy and lossless use cases.

I used the following script which relies on Google’s WebP Converter.

# Create WebP files
$ find Public/ -depth -name "*.png" -exec sh -c 'cwebp -preset picture -q 95 -hint picture "$1" -o "${1%.png}.webp"' _ {} \;
$ find Public/ -depth -name "*.jpeg" -exec sh -c 'cwebp -preset picture -q 95 -hint picture "$1" -o "${1%.jpeg}.webp"' _ {} \;
$ find Public/ -depth -name "*.jpg" -exec sh -c 'cwebp -preset picture -q 95 -hint picture "$1" -o "${1%.jpg}.webp"' _ {} \;

# Update entries references to use WebP
find Public -type f -name '*.md' -exec sed -i '' s/\.jpg/\.webp/g {} +
find Public -type f -name '*.md' -exec sed -i '' s/\.png/\.webp/g {} +
find Public -type f -name '*.md' -exec sed -i '' s/\.jpeg/\.webp/g {} +

Space used by images: BEFORE: 650Mb of images AFTER: 412Mb

— 2022-08-24