XML technologies / ePUB / Open Publication Structure / Graphics / Simple raster graphics

(Excerpt from “E-Books mit ePUB ─ Von Word zum E-Book mit XML” by Dr. Victor Wang)

XHTML and DTBook differ little in graphic references: use HTML’s familiar inline element <img> with the two required attributes src and alt. The src attribute references the image file; alt supplies alternate text if the graphic cannot display. Width and height use width and height. Our example displays the image centered as a block, enclosing it in a <div> container with a corresponding class attribute.

Block image in XHTML (Adobe Digital Editions) Block image in XHTML (iBooks)

Figures: Block image in XHTML (Adobe Digital Editions and iBooks).

 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html  PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de">
  <head>
    <title>Abbildungen und Grafiken XHTML</title>
  </head>
  <body>
    <div class="Gliederungsebene">
      <h1>JPG-Grafik</h1>
      <p>
        <strong>img</strong>: XHTML kennt nur die Bildreferenz</p>
      <div class="grafik-mitte">
        <img src="img/laokoon.jpg" alt="Laokoongruppe" width="198" height="261" longdesc="Römische Marmorkopie der Laokoon-Gruppe"/>
      </div>
      <p>Die Laokoon-Gruppe, eine römische Marmorkopie des verschollenen Originals, die heute in den Vatikanischen Museen steht.</p>
      <p class="Quelle">Quelle: <cite>Wilhelm Lübke, Max Semrau: Grundriß der Kunstgeschichte. Paul Neff Verlag, Esslingen, 14. Auflage 1908</cite>.</p>
      <p>Grafik stammt aus http://de.wikipedia.org/wiki/Laokoon_%28Lessing%29</p>
    </div>
  </body>
</html> 

Code example: Raster image in XHTML

In DTBook, block images or groups have a dedicated container, <imggroup>. Groups may contain a caption in <caption> and a source in <prodnote>. The preceding block passage, analogous to <div>, becomes this in DTBook:

<imggroup>
  <img src="img/laokoon.jpg" alt="Laokoongruppe" width="198" height="261" longdesc="Römische Marmorkopie der Laokoon-Gruppe"/>
  <caption>Die Laokoon-Gruppe, eine römische Marmorkopie des verschollenen Originals, die heute in den Vatikanischen Museen steht.</caption>
  <prodnote render="required">Quelle: <cite>Wilhelm Lübke, Max Semrau: Grundriß der Kunstgeschichte. Paul Neff Verlag, Esslingen, 14. Auflage 1908</cite> (http://de.wikipedia.org/wiki/Laokoon_%28Lessing%29)</prodnote>
</imggroup> 

Code example: Block image in DTBook

Which image format suits each use? JPEG, GIF and PNG have different properties, briefly outlined here:

Practical choices follow: use JPEG for many colors, photos or gradients; GIF or PNG for line art, black-and-white or grayscale drawings. Few-color cartoons and logos require individual judgment. For finer transparency, PNG may suit. Remember many e-readers have monochrome displays with limited grayscale. Few readers, such as iBooks, support animated GIFs.

Once the format is chosen, check image size and resolution. Print often needs high resolution; electronic screens have fewer pixels. Huge images, such as photos several thousand pixels across, may show only a small section. Reduce resolution: a current guideline, to verify individually, is at most 500–600 pixels wide. This also reduces file size, often several megabytes for high-resolution photos. Test reader behavior: Sony PRS-600, for example, fails to display a JPEG of only 860 KB at 1688 x 2232 pixels.

Another approach accommodates different screens: show a reduced-width image first, with an enlargement link to a separate page displaying it at 100% width. Large-screen readers, such as iPad with its 1024-pixel display, can thus enjoy large images.

   

 

 

 

back to top