Documentation
Image Compression
In an ePub img
directory all images, excluding the Cover, should be in a PNG format. To make sure we stay below retail channel file size guidelines and our ePubs operate smoothly when customers view our titles please use OptiPNG to compress PNG files.
Open Terminal.app which can be found in Applications > Utilities > Terminal.app.
Verify Homebrew exists with brew --version
and it should output Homebrew X.X.X
.
Enter brew list
and look to see if OptiPNG exists. If not run brew install optipng
to install OptiPNG in the Terminal. Another way to test for OptiPNG in the Terminal is to run man optipng
. If you are viewing the manual of OptiPNG you can exit out by using the q button.
Point the Terminal to the directory of images by typing cd
then dragging and dropping the folder into the Terminal, example:
bash1cd /Users/<username>/path/to/img
Verify images exist in the img
directory:
bash1ls -l
If PNG images are returned in the terminal run OptiPNG:
bash1optipng -o7 *.png
If you want an image's before and after for comparison run:
bash1optipng -k -o7 *.png
Shortcut
This is a shortcut approach to help users use OptiPNG through a shortcut that can be an entered command executed in the Terminal.
Open Termnial.app and type the command:
bash1cd && nano ~/.bash_profile
Add a comment line to indicate what is going on/reference (always a good practice to leave a comment), example:
bash1# PNG Shortcut
Add alias pngcompress='optipng -o7 *.png'
(should be on a new line), example:
bash1# PNG Shortcut2alias pngcompress='optipng -o7 *.png'
Exit the .bash_profile
using control+X and reboot the Terminal:
bash1. .bash_profile ## notice the two periods
Navigate to the folder where PNGs exist that need compression, example:
If images existed in a directory name Test on your Desktop:
bash1cd Desktop/Test
Type the command pngcompress
and you should see compression happening in the Terminal.