Last active
October 15, 2018 04:05
-
-
Save josh-richardson/6cee672981648c4a6d1e0f274e41248b to your computer and use it in GitHub Desktop.
Shoddily made bash script to lossy compress epub files which are too big. Requires jpegoptim and pngquant.
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
for i in *.epub | |
do | |
dir=`basename "$i" .epub` | |
7z x "$i" -y -o"$dir" &>/dev/null | |
find "$dir" -name \*.png -exec pngquant --quality=40-50 -f --ext .png {} \; | |
find "$dir" -name \*.jpg -exec jpegoptim -m60 {} \; | |
cd "$dir" | |
zip -9 -r "$dir.small.epub" . | |
mv "$dir.small.epub" ../ | |
cd - | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment