bell notificationshomepageloginedit profileclubsdmBox

10% popularity   0 Reactions

Note: I intended to leave this as a comment for @mosh but didn't have the necessary rep. This is my own personal solution based on the solution he outlined. This will recursively scan a specified directory and compress files larger than 49MB, overwriting the original files. [I chose that size due to the fact that Google Play Books uploads are limited to 50MB in size, and that's the service I utilize most frequently, generally with uploads from my Humble eBook Bundle purchases.]

First file: shrinkemall.sh

#!/usr/bin/bash
USAGE="Usage: [CO] directory"
: ${1:?$USAGE}
find -size +49M
-exec ./shrinkemall1.sh "{}" ;

Second file: shrinkemall1.sh

unzip -d tmp ""
cd tmp
find . -type f -iregex '^.*[.](jpg|jpeg|png|gif)$'
-exec mogrify -quality 85 -resize '800x800>' {} ;
zip -Duro "../" .
cd ..
rm -rf tmp

Obviously you'd want to edit the parameters to suit the service and/or device you're targeting.

Thanks, @mosh !


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


Load Full (0)

Login to follow story

More posts by @Radia

0 Comments

Sorted by latest first Latest Oldest Best

 

Back to top