
: Re: How can I reduce the resolution of images in an epub or mobi file? Some of the last O'Reilly ebooks I got have become really large (e.g. 60MB for the mobi version and 5.5MB for the epub
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
More posts by @Christopher