Skip to content
Novus Examples
fb21.8 KB

FB2 - Cover Embedded as a base64 binary Element

A FictionBook whose cover is a base64-encoded PNG in a binary element at the foot of the file, wired to a coverpage in the description by xlink id. For testing FB2 image extraction and the converters that have to turn that blob back into a real file.

Preview — first 33 linesfb2
<?xml version="1.0" encoding="UTF-8"?>
<FictionBook xmlns="http://www.gribuser.ru/xml/fictionbook/2.0" xmlns:l="http://www.w3.org/1999/xlink">
  <description>
    <title-info>
      <genre>sci_philosophy</genre>
      <author><first-name>Ilse</first-name><last-name>Brandt-Nakamura</last-name></author>
      <book-title>A FictionBook With Its Cover Inside It</book-title>
      <coverpage><image l:href="#cover.png"/></coverpage>
      <lang>en</lang>
    </title-info>
    <document-info>
      <author><nickname>novus</nickname></author>
      <date value="2026-08-07">2026</date>
      <id>novus-p7-fb2-cover</id>
      <version>1.0</version>
    </document-info>
  </description>
  <body>
    <title><p>A FictionBook With Its Cover Inside It</p></title>
    <section><title><p>One. The Blob at the Bottom</p></title><p>FictionBook has no container, so an image has to live inside the XML itself: base64 in a binary element at the end of the file, referenced by id from a coverpage element in the description.</p><p>That makes the cover unavoidable for a parser - it must decode the whole document to reach it - and it makes the file grow by a third of the image's real size.</p></section>
  </body>
  <binary id="cover.png" content-type="image/png">
iVBORw0KGgoAAAANSUhEUgAAAJYAAADICAIAAACF548yAAABaklEQVR42u3RQQkAIBAAQVuYwEY2
sLkvwY8RDCGCJwObYCf1sRS6ZAFCIRRChC4gFEJdIcyl6qkQIhRCIUSIEKEQCiFChAiFUAgRIkQo
hEKIECFCIRRChAgRCqEQIkSIUAiFECFChEIohAgRIhRCIUSIEKEQCiFChAiFUAgRIkQohEKIECFC
IRRChAgRCqEQIkSIUAiFECFChEIohAgRIhRCIUSIEKEQCiFChAiFUAgRIkQohEKIECFCIRRChAgR
CqEQIkSIUAiFECFChEIohAgRIhRCIUToGkIhFEKEQiiEQohQCIVQCBEKoRAKIUIhFEIhRCiEQiiE
CIVQCIUQoRAKIUKECIVQCBEiRCiEQogQIUJFIixt6qkQIhRCIUSIEKEQCiFChAiFUAgRIkQohEKI
ECFCIRRChAgRCqEQIkSIUAiFECFChEIohAgRIhRCIUSIEKEQCiFChH8TKkoIEQqhECJ0AaEQ6qgN
daid05y4/GEAAAAASUVORK5CYII=
  </binary>
</FictionBook>

Specifications

Seed
20260807
Format
FictionBook 2.0
Encoding
UTF-8
Coverpage
true
Binary Elements
1
Binary Content Type
image/png
Image Size
150x200
Base64 Line Length
76
Line Endings
LF

Testing contract

Expected to pass
Scenario
Extract the cover image and convert the book to EPUB.
Expected result
The binary element decodes to a valid 150x200 PNG, and conversion writes it out as a real image file referenced from the EPUB manifest rather than dropping the cover.

What is a .fb2 file?

FB2 (FictionBook) is an XML-based e-book format that stores an entire book, including metadata and embedded images, in a single well-structured XML file. It emphasizes semantic markup of book structure over fixed presentation. It is especially popular in the Russian-speaking e-book community.

How to use this file

Use an example FB2 to test XML e-book parsing, embedded-image extraction, metadata handling, and converters between FB2 and EPUB.

How to use this file for testing

“FB2 - Cover Embedded as a base64 binary Element” is a deterministic Novus Examples fixture for Conversion testing, Metadata testing. The same content exported across many formats and linked as a group, so you can convert one and diff against the expected twin.

Documented properties for this file: seed 20260807 · UTF-8 · LF. Compare results against paired or grouped companions on this page when present (clean↔damaged, searchable↔scanned, or format twins) so scores stay reproducible across runs.

Download the file once, keep the path stable in CI or local scripts, and treat the spec table as the contract: dimensions, seeds, field lists, and roles are intentional. Corrupt or invalid samples are labelled as such — expect parsers to fail loudly rather than silently accept them.

E-book fixtures are structured archives documented down to their spine and manifest. Test readers and converters, and where a valid↔intentionally-invalid pair exists, assert graceful handling of the malformed container.

Generated by generation/ebooks_p7.py. Free for any use, no attribution required — license.