Work with Images
Typically when most of us create a layout in InDesign, images are placed and text wrap is used to get text to flow around the image. Well, when you export to EPUB, the content “flow” takes on a whole new life. If you had a single page with a text frame and two images (the “BrianWoodTraining.com” image and the cartoon character) (see Figure 2), the EPUB would place the content on the page in order from left to right, top to bottom. So the top image would appear first, then the text, and then place the image that was on top of the text, at the bottom of the EPUB layout. Typically for EPUB, we need to either group content or anchor the images to the text to get them to stay in the flow where we want them.
Here are a few things to keep in mind with regard to images and EPUB:
- Your images will be converted to .jpeg, .gif, or .png when the ebook is exported (at around 150 ppi by default).
- There is really no need to convert them to grayscale even when the intended viewer only supports black and white. The only reason may be for file size considerations.
So let’s take a look at one way to get images to go where they should in the “flow” of the document. The first method you will see is how to get an image to align right or left and wrap text around it:
- In InDesign CS5.5, select an image on the page.
- Open the Text Wrap panel (Window > Text Wrap) and apply some text wrap to the image.
- Drag the blue square to before the first letter of the paragraph it’s next to (see Figure 4). This allows you to have the text “wrap” around the image. In the EPUB code, this assigns a “float” to the image.
On the image frame, notice the blue square towards the upper-right corner of the frame (see Figure 3). You can drag this square into text to anchor it.
Figure 3 The blue square that allows you to anchor content
Figure 4 Anchor an image by dragging the blue square
Figure 5 shows what the file will look like in the EPUB, right now.
Figure 5 What the anchored image looks like in the EPUB
Next, I will show you how to insert an image so that image flows with the text.
- Select an image on the page that you want text to “jump around.” Make sure there is no text wrap applied to it.
- This time, press and hold the Shift key and drag the blue square from the image frame before the first letter of a paragraph. This inserts the image inline, instead of anchoring it like the previous image (see Figure 6). It’s more like copy and pasting the image into the text.
Figure 6 Anchor an object inline
When you export to EPUB, you can choose settings for all of the images such as resolution and alignment. But what if one of those images needs to have different export settings? You can assign custom export options to content (an image, for example) like alignment or resolution, which is what you’ll do next:
- Select the inline image on the page (the last image you anchored with the Shift key).
- Choose Object > Object Export Options.
- Select the EPUB and HMTL tab.
- In the Object Export options dialog box, you can assign custom rasterization settings like resolution. You can also assign an alignment (left, center, right). Select Custom Image Alignment and Spacing. Click the Align Center button. Add spacing before and after the image if you like by increasing those values (see Figure 7). Watch out, though! Notice the unit Ems? 1 Em is around 11-16px or so, so be careful. You can always switch to pixels for units if you are unsure.
- Click Done. The image will still look like it’s just stuck in the text, but in the EPUB file it will look right.
Figure 7 Setting image specific export options