Last active
September 6, 2020 18:00
-
-
Save omarryhan/a5db65e5972b09d8fa4e2925482b924b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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