bell notificationshomepageloginedit profileclubsdmBox

10% popularity   0 Reactions

bash script to for bulk compressing images in big.epub to small.epub on Windows7 or Linux.
You need to install cygwin on windows for (bash, unzip, zip, find, imagemagick).

#!/usr/bin/bash
USAGE="Usage: [CO] big.epub small.epub"
: ${2:?$USAGE}
unzip -d -tmp # unzip big.epub in tmp directory
cd -tmp
# Compress all images larger than NxN in tmp
find . -type f
-iregex '^.*[.](jpg|jpeg|png|gif)$'
-exec mogrify -quality 85 -resize '400x400>' {} ;
zip -Duro ../ . # Zip up the compressed tmp folder as small.epub
cd ..
rm -rf -tmp # Cleanup

You can just get rid of all images in one step from epub file with winzip or zip, the tiny epub will still be readable without illustrations. Keep a backup of big.epub, if you want to see the images later on.

zip -d big.epub "*.jpg"


Free books android app tbrJar TBR JAR Read Free books online gutenberg


Load Full (0)

Login to follow story

More posts by @Christopher

0 Comments

Sorted by latest first Latest Oldest Best

 

Back to top