Quote:
Originally Posted by tatagi
many thanks. yes that's the most foolproof way but at the same time very tiresome to individually edit files one at a time.
|
Why edit them one at a time? With something like ImageMagick you could batch-convert a bunch. I would likely do it something like this, on Linux. Assumes all your image files are jpegs (with extensions of ".jpg" or ".jpeg") and you want a max filesize of 1MB per image file:
Code:
$ unzip -d working_dir "book filename.epub"
$ cd working_dir
$ find . -iname "*.jpg" -o -iname "*.jpeg" -execdir mogrify -define jpeg:extent=1MB '{}' ';'
$ zip -r "book filename.compressed.epub" .
$ mv "book filename.compressed.epub" ..
$ cd ..
$ rm -rf working_dir
Note that ImageMagick's “mogrify” command modifies files in-place. This is (potentially) a DESTRUCTIVE operation!