TIKA-4852: EpubParser emits the OPF cover image as a THUMBNAIL embedded document - #3093
Merged
Merged
Conversation
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.
dschmidt
force-pushed
the
epub-cover-thumbnail
branch
from
August 29, 2026 12:22
3b3539d to
cb4c5ec
Compare
Contributor
There was a problem hiding this comment.
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-imageproperty, fallback to EPUB 2meta name="cover"). - Mark the cover image’s embedded metadata with
TikaCoreProperties.EMBEDDED_RESOURCE_TYPE=THUMBNAILwhen 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-imageproperty 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