View Full Version : How to shrink ePub file size


karenbryant
01-01-2012, 07:06 AM
Hi,
I've just finished producing an epub ebook, and I'm delighted with the end product. However, there are many images (about 1,500) inside it, which makes the end product 110mb. Is there anyway of compress the size? I know on mobi pocket you can select a compress option which makes the file smaller, is there any software that can do that for epub? At the moment I'm using Atlantis to produce the file.

frostschutz
01-01-2012, 07:31 AM
Images can't be compressed well by ZIP & Co, so you'll have to work with the images themselves (try JPEG/PNG/GIF, lower resolution, lower color depth, lower quality). JPEG is best for photographs, PNG/GIF may perform better for diagrams and the like. Try all formats and use whatever is smallest. Be careful not to lose quality in the conversion process (always keep the original, and produce all other formats based on this original).

Most readers use 800x600, some 1024x768 and only tablets have higher resolutions at this time, so if your images are larger than that you can make them smaller. If you are targeting eInk devices you can reduce the color depth to 16 levels of gray, which would certainly help to make PNG/GIF smaller, but iPad users would be rather miffed. ;-)

Also check that your images don't contain unnecessary elements (such as borders or other things that could be done in HTML instead). Also check that you don't have duplicate images as generators or PDF to HTML converters like to duplicate stuff unnecessarily.

karenbryant
01-01-2012, 07:40 AM
Thanks. Do you know a good macro I could use in Word to reduce the image sizes? Doing it 1500 times will take a very long time!
Also, how do I reduce the color depth to 16 levels of gray-don't really understand!? Is there some way of doing that for all pictures in one go?
Thanks for your help; much appreciated.

frostschutz
01-01-2012, 07:57 AM
Do you know a good macro I could use in Word to reduce the image sizes?

I don't use Word so I can't help you at all with macros and stuff.

Doing it 1500 times will take a very long time!

As long as you want to perform the same steps on every image you can just use any image manipulation program that supports batch processing (i.e. modify all images at once).

Maybe Calibre/Sigil have some support for this, I'm not sure.

What kind of book are you making anyway? Comic? Picture book? Regular book with illustrations? How important is the picture quality?

If you PM me a sample of your book with a couple of images I'll take a look at it, can't promise you anything concrete though.

dwig
01-01-2012, 08:53 AM
...
Also, how do I reduce the color depth to 16 levels of gray-don't really understand!? Is there some way of doing that for all pictures in one go?
Thanks for your help; much appreciated.

To do this you need an image editor or image conversion program. You would extract copies of the images from the epub, edit them with an image editor (e.g. Adobe Photoshop, Corel PhotoPaint, Gimp, ...) to make the changes, and then copy the edited image back into the epub to replace the originals.

The epub file is really just a specially organized ZIP archive. If you change the extension from .epub to .zip you can get access to its contents. Simply display the contents (on Windows a simple double-click on the ZIP is open a window), navigate to the images, and drag out copies. Edit those copies and then drag them back into the same folder overwriting the originals in the ZIP. Doing it that way you don't disturb the special organization of the other files in the epub. When done, simply change the .zip extension back to .epub and test the file.

mrmikel
01-02-2012, 06:53 AM
You might consider getting irfanview, a free program that is small, that has batch conversion options, including rename and resize. Resize is under advanced options under batch conversion.

It is much simpler to use than some of the other programs mentioned. The others are great for more complicated work.

You may need to decide who your audience is for the book. The images needed for readers like your Nook can be much small and simpler than for ipad and computer users. Change color depth is an advanced option under Batch Conversion in irfanview.
Images can be saving using varying levels of color information from only black and white, 16 to 256 levels of gray, 256 different colors up to millions of colors. The e-ink readers can only show 16 levels of gray so any other colors have to be converted by the reader anyway.

Make sure you have your original epub safely away on a CD or DVD while you work with this or rename the file while you work with it. You may spend a while at this if things don't go well and something may seem like a brilliant idea after a number of hours, but instead wipe out all your work. If you use Sigil and work with the code, it is possible to get in a situation where you leave out a closing command, Sigil will offer to fix it automatically and automatically leave out a good chuck of your document.

But if things go well, it can be as simple as dwig outlines.

karenbryant
01-02-2012, 09:23 AM
Thanks for all the advice, everyone. I'll try irfanview at once!

SBT
01-03-2012, 03:16 AM
Imagemagick should also get a mention. Very powerful; truly excellent for batch work. Unix-based, but you can get it for Windows.
Not so excellent for a beginner... There's definitely a learning curve, plus you need to learn some shell scripting. However, if you are going to edit 100+ images, the effort is probably worth it.

JSWolf
01-03-2012, 03:24 AM
Before you go messing with your images. Remember, some people do read on a computer with hi-resolution and if the images don't look good on a computer, then you've lost customers for any future books.

DSpider
01-03-2012, 03:50 AM
Yeah but if the file size is 110 MB... A lot of people won't be too happy - for instance the Nook Touch users. Even though it's advertised as having 2 GB storage, the actual space (for non-B&N store bought books) is around 200 MB.

Hmm... 1500 images? That's not a book, that's a photo album! If many of them are similar you could choose one and simply display it in several parts of the book.

stxopher
01-03-2012, 12:44 PM
If many of them are similar you could choose one and simply display it in several parts of the book.

Actually, that's a good point. Are all 1500 unique or are there instances where the same pix is used in different locations using copies of itself? (Page breaks, header bars, things like that.)

JSWolf
01-03-2012, 09:43 PM
Are you using graphics for say chapter titles where you could take them out and use text instead?

What sort of book is this that has 1500 images?

Freeshadow
01-10-2012, 12:26 PM
for images you might try this http://luci.criosweb.ro/riot/

chrisridd
01-10-2012, 12:56 PM
Are you using graphics for say chapter titles where you could take them out and use text instead?

What sort of book is this that has 1500 images?

I've got one textbook that seems to have every table and code fragment embedded as a JPEG. 1960 of the suckers! It has some genuine diagrams in there too. The book's only 80MB though, tiny compared to Karen's :) The PDF version of it is just over 8MB...

I don't know if it is common to render code fragments as images or not. It is one way to avoid line wrapping problems I suppose.

The textbook in question is DTrace - Dynamic Tracing in Oracle Solaris, Mac OS X, and FreeBSD. The epub is quite readable on my Sony PRS-T1 despite the size.

AndrewH
01-11-2012, 03:55 PM
Are the images color or black and white? If they're black and white, are they actually encoded as black and white? That will save some space.

dstehle
02-24-2016, 12:30 PM
mrmikel, your IRfanview suggestion worked perfectly. I changed a 40Mb epub file to 5Mb with no visible loss in image clarity.


dstehle

Notjohn
02-26-2016, 03:51 PM
Thanks for the information about Irfanview. I got this oddly named program because I bought a Canon scanner with really awful software. I really like Irfanview but haven't explored it much because I do most of my image editing in Photoshop Elements.

rraod
03-01-2016, 08:15 AM
Irfanview can also be used as scanning software for scanners with twain driver.

I have been using this software for more than 10 years, and this handles most of my photo editing needs. A very versatile program. Recently Irfanview is released in 64 bit version also.

JSWolf
03-01-2016, 08:26 AM
If the ePub contains embedded fonts, subset the fonts and also losslessly compress the images in the ePub. Both of those things will reduce the size of the ePub.

Hitch
03-09-2016, 12:45 AM
If the ePub contains embedded fonts, subset the fonts and also losslessly compress the images in the ePub. Both of those things will reduce the size of the ePub.

For anyone coming along later, you know, the silly little program ezThumbnails will also batch process images in a single go. I've used it with geat success for initial pass operations. Works best with JPEG-->JPEG, but it's surprisingly flexible and efficient.

I have a ton of other programs that do similar functions, but I'm always surprised at how often I find uses for this one.

FWIW.

Freeshadow
03-09-2016, 03:01 AM
for images you might try this http://luci.criosweb.ro/riot/
That for lossy, png gauntlet and similar for lossless

For anyone coming along later, you know, the silly little program ezThumbnails will also batch process images in a single go. I've used it with geat success for initial pass operations. Works best with JPEG-->JPEG, but it's surprisingly flexible and efficient.

I have a ton of other programs that do similar functions, but I'm always surprised at how often I find uses for this one.

FWIW.

JSWolf
03-09-2016, 08:58 AM
For anyone coming along later, you know, the silly little program ezThumbnails will also batch process images in a single go. I've used it with geat success for initial pass operations. Works best with JPEG-->JPEG, but it's surprisingly flexible and efficient.

I have a ton of other programs that do similar functions, but I'm always surprised at how often I find uses for this one.

FWIW.

Could you please compare ezThumbnails to Calibre to see which one makes smaller files? I'll be comparing Calibre to ePUBOptimizer to see which makes smaller files.

Hitch
03-09-2016, 01:31 PM
Could you please compare ezThumbnails to Calibre to see which one makes smaller files? I'll be comparing Calibre to ePUBOptimizer to see which makes smaller files.

Wolfie, mon sweet:

Well. I freely admit, I have no idea how to do that in Calibre. Wanna drop a hint, and I'll see if I can scrape up some time today/tomorrow?

(You know, I keep telling you guys, I use Calibre for a library for our converted books, and that's about it. I'm not kidding youse! :-) I have recently tried the editor. It's quite nice. But that's about all.)

Hitch

JSWolf
03-09-2016, 04:37 PM
To losslessly compress images in Calibre, it's in polish books.

Freeshadow
03-09-2016, 04:49 PM
I'm pretty sure that calibre comes without any polish books :P I'd have noticed.

JSWolf
03-09-2016, 05:13 PM
I'm pretty sure that calibre comes without any polish books :P I'd have noticed.

Right click on a book and from the popup menu, select Polish books. So yes, there is Polish books.I use it a lot.

Freeshadow
03-09-2016, 06:03 PM
*sigh* can I get a pair of pun tags please?

Hitch
03-09-2016, 06:31 PM
*sigh* can I get a pair of pun tags please?

I think we have to make them ourselves. Somehow, Polish books, Calibre, and Jon just all combine for a giggle. (Sorry, my sweet curmudgeon!)

@Wolfie:

So, you want me to take an ePUB, polish it in Calibre, whilst having made an unpolished copy, and reducing those images with the thumbnail tool? I can do that, although I probably should say that 80+% of the time, I'd be using my fileoptimize tool.

Hmph...now I have to find an ePUB with images that have magically escaped our beady optimization eye. Do you have one from the MR library you're using for this test, Jon?

Hitch

BetterRed
03-09-2016, 07:48 PM
So, you want me to take an ePUB, polish it in Calibre ...
@Hitch - FWIW you can calibre polish an ePub at the command line, no need to be russian off to czech it into a library.

Also because of this (http://www.mobileread.com/forums/showthread.php?t=271816) I've given X1 a :thumbsup:

BR

Tex2002ans
03-10-2016, 02:59 PM
Ever since it was added in Calibre, I can't help reading "Polish Books" as "Polish Books". :rofl:

Freeshadow
03-10-2016, 03:39 PM
Ever since it was added in Calibre, I can't help reading "Polish Books" as "Polish Books". :rofl:

Which was exactly my point. Were there any of them I would have certainly looked into.

Jellby
03-12-2016, 02:37 AM
Ever since it was added in Calibre, I can't help reading "Polish Books" as "Polish Books". :rofl:

Yeah, they should rename that as "Finnish Books" ;)

BetterRed
03-12-2016, 06:29 AM
Yeah, they should rename that as "Finnish Books" ;)
I think they should wait 'til me and ma gets its new president :)

Hitch
03-12-2016, 01:21 PM
Yeah, they should rename that as "Finnish Books" ;)

Either way, though, the Polish books or the Finnish(ed) books...we still have to worry about Russia crossing their borders, no? ;-)

Hitch