Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# sudo apt install webp imagemagick parallel
# I ran this on 59 very high quality PNGs and my processor was maxing out for about a minute or so. I have an Intel Core-i7-8750H.
cd folder-with-huge-ass-png-files
# convert to webp in the same folder
parallel -eta cwebp {} -o {.}.webp ::: *.png
# Run resize commands in parallel (on many processes/threads). Adjust numbers to taste.
mkdir -p 512x-png && parallel -eta convert {} -resize 512x512 512x-png/{.}.png ::: *.png
mkdir -p 1080x-png && parallel -eta convert {} -resize 1080x1080 1080x-png/{.}.png ::: *.png
mkdir -p 1080x-webp && parallel -eta convert {} -resize 1080x1080 1080x-webp/{.}.webp ::: *.webp
mkdir -p 2160x-webp && parallel -eta convert {} -resize 2160x2160 2160x-webp/{.}.webp ::: *.webp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment