-
Notifications
You must be signed in to change notification settings - Fork 26
Epub Cover Page Variants
The contents.opf
file is used to specify the contents of the EPUB file, including a cover page. Unfortunately, EPUB files are not consistent in how they specify the cover info. This is due to changing EPUB standards over time, and differences between EPUB authoring programs. [Note too that the .opf
might not be called contents.opf
; it first had to be found by examining META-INF/container.xml
].
Here I will attempt to describe the different EPUB cover page specifications DarkThumbs attempts to handle. The following examples are all taken from real EPUB files.
-
<meta>
tag and matching<item>
tag. Match happens byid
value. Example:
<meta name="cover" content="cover"/>
<item href="cover.jpeg" id="cover" media-type="image/jpeg"/>
-
<meta>
tag contains the cover file path. Note: this must be handled as a "fall-through" case of #1, because theid
to match for might "look" like an image path. Example:
<meta name="cover" content="Images/cover.jpg" />
and a counter-example, which must be handled as case #1 above:
<meta content="cover.jpg" name="cover"/>
<item href="images/cover.jpg" id="cover.jpg" media-type="image/jpeg"/>
-
Added for V1.2 : No useful
<meta>
tag but an<item>
tag with anid
value of "cover-image". Example:
<item href="EPUB/images/9781284157468_FC.jpg" id="cover-image" media-type="image/jpeg"/>
-
TBD : No useful
<meta>
tag but an<item>
tag with anid
value of "cover".
<item id="cover" href="cover.xhtml" media-type="application/xhtml+xml" />
Note the href
is to an (x)html file. The cover file may be found in the referenced file using an <img>
tag:
<img class="cover-image" src="Images/37b858a6-f3e9-4df3-a4aa-be9255a82a21.png"/>
- A
<manifest>
entry with anid
value ofcover-image
. Epub V3.0 support. For example:
<manifest>
<item id="toc" properties="nav" href="TOC.xhtml" media-type="application/xhtml+xml"/>
<item id="cover-image" properties="cover-image" href="images/a-christmas-carol.jpg" media-type="image/jpeg"/>
-
An ebook from "Standard Ebooks": the cover image may be a SVG file. Check to see if the SVG file has an embedded, base64-encoded JPEG file. If so, decode that embedded file. [At this time, Microsoft Windows doesn't provide SVG support in their image library.]
-
None of the above. DarkThumbs will use the first image file with the name "cover".
-
None of the above. DarkThumbs will use the first image file (obeying the "Sort" option).