fogbound.net




Fri, 11 Oct 2024

Quick file size computation

— SjG @ 2:13 pm

So your site was using too much bandwidth, and you converted all those animated .gif images to .webp using the WebPShop plugin.

But how many bytes have you actually saved? The command line will tell you:

ls -l *.gif | awk '{ print $5 }' | paste -sd+ - | bc 
ls -l *.webp | awk '{ print $5 }' | paste -sd+ - | bc 

Of course, this assumes that all the files in the current directory are the images and their conversions, and there aren’t a bunch of other files with one of those extensions. If that’s not the case, you’ll need to be more specific than *.extension in the ls command.