Woodwing's Digital Magazine Tools (www.woodwing.com/en/digital-magazine/ipad-now) are great to create magazines for tablet devices. Unfortunately the images used to display the magazine could be much smaller and still shown in good quality.
The ImageSqueezer-Script takes care of this problem by doing the following changes in /magazine/images/story_* :
It looks for JPGs and adjusts their compression if needed.
It looks for PNGs having no transparency. It converts those PNGs to JPGs and adjusts the compression on those JPGs.
With the default values of the script it should be possible to reduce the size of your magazine of ~30%.
NOTE: I WON'T PROVIDE ANY SUPPORT ON INSTALLING AND RUNNING THIS SCRIPT: RTFM! :) FEEL FREE TO READ THIS DOCUMENT AND THE DOCUMENTED CODE IN THE SCRIPT TO UNDERSTAND HOW IT WORKS.
Nokogiri Gem (nokogiri.org)
RMagick Gem (rmagick.rubyforge.org)
This “ingredients” need to be installed and working for the script to run correctly. You'll find instructions on how to install them on the websites mentioned above. Please use RubyGems to install Nokogiri and RMagick if you don't know exactly what you're doing.
Download imagesqueezer.rb from Github (github.com/vazqujav/ImageSqueezer)
Put the file imagesqueezer.rb somewhere you will find it again ;-)
ruby imagesqueezer.rb [options] <directory>
In words: Run the script and give the magazine directory as argument. The script expects a file named 'magazine.xml' and a folder named 'images' inside the magazine directory. Besides that it expects PNG paths to be in an XML node (in magazine.xml) named 'url'.
ruby imagesqueezer.rb magazine/
This would recursively parse '/magazine/images/story_*' and apply itself to all JPGs and non-transparent PNGs.
How can I change the compression quality? Look for the constants PNG_COMPRESSION and JPG_COMPRESSION in the script. By changing them you're able to tweak the compression.
Copyright 2011 Ringier AG, Javier Vazquez
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <www.gnu.org/licenses/>.