Skip to content

TIKA-4852: EpubParser emits the OPF cover image as a THUMBNAIL embedded document - #3093

Merged
THausherr merged 2 commits into
apache:mainfrom
dschmidt:epub-cover-thumbnail
Aug 29, 2026
Merged

TIKA-4852: EpubParser emits the OPF cover image as a THUMBNAIL embedded document#3093
THausherr merged 2 commits into
apache:mainfrom
dschmidt:epub-cover-thumbnail

Conversation

@dschmidt

Copy link
Copy Markdown
Contributor

EpubParser emitted every image as an untyped embedded document, so a client had no way to tell the cover from the other images. The OPF names it: EPUB 3 with the cover-image property on the manifest item, EPUB 2 with <meta name="cover" content="<item id>"/>. The parser now resolves the cover (property first, meta as fallback) and emits that image as the THUMBNAIL embedded document, like the preview image of the other container formats. Both fixtures cover one of the two ways.

https://issues.apache.org/jira/browse/TIKA-4852

@dschmidt
dschmidt marked this pull request as ready for review August 29, 2026 11:17
The OPF names the cover: EPUB 3 with the cover-image property on the
manifest item, EPUB 2 with a cover meta naming the item id. Resolve it
(property first, meta as fallback) and emit that image as the THUMBNAIL,
like the preview image of the other container formats.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request updates EpubParser to identify the EPUB publication cover image from the OPF (EPUB 3 cover-image manifest property, with EPUB 2 <meta name="cover" ...> as fallback) and emit that cover image as a THUMBNAIL embedded document so downstream clients can reliably distinguish it from other embedded images.

Changes:

  • Resolve the OPF-designated cover image ID (EPUB 3 cover-image property, fallback to EPUB 2 meta name="cover").
  • Mark the cover image’s embedded metadata with TikaCoreProperties.EMBEDDED_RESOURCE_TYPE=THUMBNAIL when emitting embedded documents.
  • Add/extend tests to assert cover image identification and thumbnail typing for both EPUB 2 and EPUB 3 fixtures.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-miscoffice-module/src/main/java/org/apache/tika/parser/epub/EpubParser.java Detect OPF cover image and emit it as THUMBNAIL embedded metadata.
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-miscoffice-module/src/test/java/org/apache/tika/parser/epub/EpubParserTest.java Add assertions ensuring the OPF-designated cover is emitted as the thumbnail and others are not.
CHANGES.txt Document the behavior change for TIKA-4852 in the 4.1.0 release notes.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@THausherr
THausherr merged commit a8b354f into apache:main Aug 29, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants