Why is that in some cases images appear either totally pixelated or as a minute little graphics when generating an EPUB document from an existing InDesign file that was not originally created for EPUB purposes? The answer is found by taking a closer look at how our images are placed in InDesign as well as looking at the selected Digital Editions Export Options we’re using for Images when generating our EPUB files.

Note: Samples provided in this write-up were created with InDesign CS5 (7.0.2) and Digital Editions Export 3.0.0

Unravelling the image size and quality mystery

Let’s start by taking a look at an image that’s been placed in an InDesign document. I admit I’ve exagerated things a little here 🙂 to really emphasise what’s going on behind the scenes.

A closer look at the image in InDesign in the Links and Control panels reveals information that will help us understand what’s happening to our placed images during EPUB export.

screenshot of the links panel in InDesign displaying the actual ppi and effective ppi settings as well as the scaling amount.

The pixel dimensions of the source image that is placed in InDesign is 800 x 451 pixels.

The Actual PPI for the placed image is 1350 ppi. This is the true image resolution of the source file that InDesign references in the Links panel.

The Effective PPI setting for the image is much, much lower at 143ppi, due to the fact that I’ve increased the image size in InDesign by well over 900 per cent (942.78% to be exact).

It’s time to see what happens to this image when we export the InDesign document to EPUB. I’m working in InDesign CS5 by the way.

Exporting to EPUB with Formatted unchecked

The Images section in the Digital Editions Export Options dialog provides us with an option named “Formatted”.  First of all let’s look at what happens when we export our images with this option disabled.

Digital Editions Export Options dialog box, with Formatted option unchecked

What’s going to happen? Well, no matter which option we choose here, the resulting images always turns into a file a 72ppi resolution.

When we use the unformatted setting, InDesign grabs the original source image, and basically changes the image resolution from the original resolution (1350ppi) to the target resolution (72ppi), whilst retaining the physical width and height of the image and throwing out a bucket load of pixels…

Without grabbing a calculator let’s jump across to Photoshop and have a look what actually happens…  I’m looking at Image > Image Size dialog here…

Here are the settings of the unaltered image:

Image Size dialog in Photoshop, displaying the original image size.

Notice this image is only 1.51cm x 0.85cm in physical dimensions? That’s smaller than the average postage stamp 🙂 Next with the Resample Image option enabled, let’s change the Resolution to 72ppi and check-out the new pixel dimensions.

Image Size dialog box in Photoshop after changing the resolution.

Wow! Yes, you’re not imagining things here. What we are seeing is the result of resampling — the throwing out or inserting of pixels —We’re left with a measly 43 x 24 pixels, and that my dear friends is all we’d end up with for this image in the resulting EPUB.

Here’s the result (grab your magnifying glass to check things out 😉 )

postage stamp result after resampling the image.

Exporting to EPUB with Formatted checked

So would the result be any better if we enable the Formatted checkbox in the Digital Editions Export Options dialog? I’m afraid not.

What the formatted option does differently in comparison is that:

  • if we’ve added a border to our image, or a drop shadow or other effect etc., the resulting EPUB graphic will retain the applied formatting settings.
  • addtionally, if we’ve masked part of the image away, the resulting EPUB graphic will be cropped to only display that part of the image that is visible in InDesign.
  • lastly, if the image has been scaled up or down, the same scaling percentage will be applied to the image after it first has its resolution changed to 72ppi

Note: keep in mind that images that bleed off the page, will have their bleed area included in the resulting EPUB output when the Formatted option is enabled. You’d need to mask the images to the page edge prior to generating the EPUB to obtain a crop area that matches the image area you see on the page itself in InDesign.

It’s this last setting that once again, can result in some highly unexpected results.

If we look at the previous image. We’ve already seen what happens when the image is resampled to 72ppi — it looses most of its pixels and we’re left with just a handful of them —. So what happens to if after this initial resampling we apply our 942.78% enlargement?

I’m jumping back into Photoshop for a second to demo what’s going to happen.

Image Size dialog in Photoshop, upscaling the image.

Ok, cool! So we end up with more pixels then the previous scenario. Unfortunately we’re cheering a little too early. Let’s look at the result 🙂

upsized and resampled result

In a nutshell, it’s the resampling that occurs that causes the various quality issues we’re seeing in the resulting EPUBs.

So how can we control our image qualities better when creating EPUBs from InDesign?

Getting the better image results in EPUB

There are various things we can do.

If we take things out of InDesign what we could do is run our images through an image processor — e.g. Photoshop’s File > Scripts > Image Processor — and ensure they all are rendered to have optimum pixel dimensions for EPUB purposes (between 300 and 600px), then ‘break’-open the .EPUB file and swap out the exported images with the separately rendered images and repackage the .EPUB file.

Another option that will increase the quality significantly, is to ensure that minimal resampling occurs when the images are exported as part of the InDesign EPUB export. To do that we’d need to ensure our images are placed at close to 72ppi and are not scaled.

If the publication you’re converting to EPUB has been published for print prior to being converted for EPUB, it might be worthwhile to first of all run a Script that ensures that all images are placed at 100% at their original image resolution (e.g. 300ppi for print). Once that step has been completed you could take the resulting collection of images and converting them to 72ppi, RGB, JPEG format. Then prior to generating the EPUB from InDesign swap the original images with their JPEG replacements.  InDesign has a very cool Relink to Folder function that allows to link to similarly named images with a different file-extension that are stored in a particular directory.

If you’ve been using a particular script to perform this task let me know and I’ll gladly test it as well and give it plug at the bottom of this post 🙂