Hi all!
A friend an I cobbled together a very rough script for OSX to resize large images down to 2 Million Pixels to conform with iBookstore Asset Guide 4.7 Rev.3:
- The maximum recommended size is 2 million pixels per image. Larger images may not appear as expected in the iBooks app.
I also used platypus to convert it to an OSX-App.
Download App here:
http://mmsizr.googlecode.com/files/MMSizr.app.zip
Usage: - Unzip epub.
- Start App and drop your images Folder on main window.
- App searches for jpg, png, gif images an resizes to 2 Million pixels if necessary.
Image names must not contain whitespaces.
Original shell-Script:
Code:
#!/bin/sh
MAXsize=1900000;
for v in `find $1/*.jpeg $1/*.jpg $1/*.gif $1/*.png`; do
h=`sips -g pixelHeight $v | tail -1 | sed "s/.* //"`
w=`sips -g pixelWidth $v | tail -1 | sed "s/.* //"`
pxlnmbr=`echo "$h*$w" | bc`;
echo "Number of Pixels in $v ($w x $h) is $pxlnmbr";
if [[ $anzahl -gt $MAXsize ]]; then
factor=`echo "scale=5 ; sqrt($MAXsize / $pxlnmbr) " | bc`;
echo "factor: $factor";
newWidth=`echo "scale=5 ; $w * $factor" | bc`;
newHeight=`echo "scale=5 ; $h * $factor" | bc`;
echo "$v new: $newWidth x $newHeight";
sips -z $newHeight $newWidth $v
echo " ";
fi
done
yes it's rough. Please feel free to improve:
http://mmsizr.googlecode.com/files/mmsizr.sh.zip
Project page:
https://code.google.com/p/mmsizr/
--edit--
Download App here:
http://mmsizr.googlecode.com/files/MMSizr.app.zip
Consider Flattering this article, if you liked this app:
http://suntoucher.de/mmsizr-a-script...illion-pixels/