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.