![]() |
#1 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
ePUB Optimizer
Another small tool to help out. This program subsets fonts used in ePUB's (identical to the routines used in my FontShrinker program), but will also optimizes JPG, PNG and GIF images. The compression factor for the ePUB (or actually zip) will be maximized.
Latest version (currently 1.12) can be downloaded from my site or here. Usage is simple. Create an icon and just drop the ePUB on it or start via command tool. There is also a Sigil plugin for this program. With that plugin this program can be called from within Sigil to update the images and fonts. The page for that plugin can be found here. The program can also be run via Mono on Linux and OSX. Last edited by Toxaris; 11-09-2015 at 11:07 AM. |
![]() |
![]() |
![]() |
#2 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 13,263
Karma: 78869092
Join Date: Nov 2007
Location: Toronto
Device: Libra H2O, Libra Colour
|
Any chance of an option to convert from colour to gray scale for images?
|
![]() |
![]() |
![]() |
#3 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 13,263
Karma: 78869092
Join Date: Nov 2007
Location: Toronto
Device: Libra H2O, Libra Colour
|
Just tried it. Gor the following error at the end:
Code:
Unhandled Exception: System.UnauthorizedAccessException: Access to the path 'C:\Program Files (x86)\Toxaris\ePUBOptimizer\actionlist.txt' is denied. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, BooleanbFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.StreamWriter.CreateFile(String path, Boolean append, Boolean checkHost) at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize, Boolean checkHost) at System.IO.File.InternalWriteAllText(String path, String contents, Encoding encoding, Boolean checkHost) at System.IO.File.WriteAllText(String path, String contents) at Toxaris.ToxarisUtils.OperationsIO.WriteStr2File(String FileName, String Text) at ePUBOptimizer.Module1.HandleePUB(String ePUB) at ePUBOptimizer.Module1.Main() C:\Users\Peter\Documents\Peter's Library\Yvonne Stephens\Amazing 7 Minute Meals_ Over 100 Recipes (1471)> |
![]() |
![]() |
![]() |
#4 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
Hmm, that is strange. The application should be able to write in its own directory. No worry, I will adapt this to make sure it will work. Probably later today.
I will look into the grayscale thing, but I am not too sure. I want to make it lean and mean without too much options. Have to think about it. |
![]() |
![]() |
![]() |
#5 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
Small update where the write error is solved and better handling of media queries.
|
![]() |
![]() |
![]() |
#6 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
And again a new version to which an option is added. This option actually controls the way the subsetting will be done. If the -f option is given, the glyphs to be retained are calculated based on the complete font-family instead of just for that font. This can cause that more glyphs are retained, but will ensure that a font that is improper used will be deleted.
|
![]() |
![]() |
![]() |
#7 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
Updated version. Various enhancements and fixes, such as improved performance and included helper applications for OSX as well.
|
![]() |
![]() |
![]() |
#8 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
New version is out. Besides solving a serious bug there is a change in the way of working. If from one font family multiple fonts are delivered, the actual usage per font is checked. However, if only one font for that font family is delivered, the usage of the complete font family is checked, not taking bold/italic into account. This is less strict perhaps, but resembles more the actual usage of fonts in ePUB I guess.
|
![]() |
![]() |
![]() |
#9 |
Obsessively Dedicated...
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,202
Karma: 34984330
Join Date: May 2011
Location: JAPAN (US expatriate)
Device: Sony PRS-T2, ADE on PC
|
Hi Toxaris. Could you give a bit of detail about the specific ways the images are optimized? That is, do you use only a stronger file-compression algorithm?
Or does it reduce bit-depth for pngs, increase compression (lower "quality setting") of jpegs? Thanks. |
![]() |
![]() |
![]() |
#10 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
Sure, for JPEG I use JPEGTRAN and for PNG I use OPTIPNG. I do not change the compression value for JPEG, because that can cause quite some unexpected results. That should be done manually.
Most is removal of unused information/data and reduction of depths and alike. If you would like, I can give the exact parameters I feed into these programs. |
![]() |
![]() |
![]() |
#11 |
temp. out of service
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,812
Karma: 24285242
Join Date: May 2010
Location: Duisburg (DE)
Device: PB 623
|
![]()
Some ideas:
For metadata removal only you could use jpegoptim too. Similar could be done with SVG: http://code.google.com/p/svgmin/ Ruben found out that extracting the SVG code from the file and inline embedding it directly into the epub makes significantly smaller files too. It would be worth to check back with Hitch how different reading systems react to inline svg code. Are you recompressing with Zopfli? AdvanceCOMP: Advpng for the images; Advzip for the finished epubs. When I was digging for shrinking tools for Hitch I also searched for minification tools which could be applied to the epub's CSS and sources, but found only *. js stuff for use with webservers. Have no idea how to utilise it. Minification could be worth being looked up too. Apart from that - what you are doing here: intelligent standalone tools for font subsetting; storage footprint optimisation (I'm a compression fan myself ![]() |
![]() |
![]() |
![]() |
#12 |
Obsessively Dedicated...
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,202
Karma: 34984330
Join Date: May 2011
Location: JAPAN (US expatriate)
Device: Sony PRS-T2, ADE on PC
|
@Toxaris, Yes, please do share your parameters. I am looking for ways to get smaller image files, because it seems like every project I start on a whim turns out to be very image-heavy. Especially now, when I have decided to go with higher-resolution images instead of 600x800.
Quite some time ago, I tried out ScriptPng (Tex2002ans recommendation on several threads), and it does a nice job. But you have to watch the parameters, as it tends to reduce bit-depth to 4-bit, which would not display properly in some Sony devices due to a Sony bug. Love your tools! Greatly appreciated! |
![]() |
![]() |
![]() |
#13 | |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 78,936
Karma: 144284074
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
If you want to know about this, I can post what you is needed to get that extra bit reduced. |
|
![]() |
![]() |
![]() |
#14 |
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
I get great results out of zopflipng -- just remember to set it going overnight
![]() ![]() |
![]() |
![]() |
![]() |
#15 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 78,936
Karma: 144284074
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
ePUB Optimizer | Toxaris | Plugins | 166 | 11-16-2021 05:59 PM |
Comic optimizer script | rhon | Kobo Reader | 0 | 11-08-2012 06:04 PM |
Mokle - Mangas Optimizer for Kindle | devorez | Kindle Developer's Corner | 11 | 08-14-2012 07:15 PM |
Patent/Heavy graphics pdfs and Adobe PDF Optimizer | andrewscheinman | iRex | 4 | 12-26-2009 11:39 AM |
PRS-500 PDF file optimizer | phigdon | Sony Reader Dev Corner | 1 | 04-01-2007 11:40 PM |