[
https://issues.apache.org/jira/browse/TIKA-4851?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18109407#comment-18109407
]
ASF GitHub Bot commented on TIKA-4851:
--------------------------------------
dschmidt commented on code in PR #3091:
URL: https://github.com/apache/tika/pull/3091#discussion_r3886450572
##########
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-image-module/src/main/java/org/apache/tika/parser/image/RawTiffParser.java:
##########
@@ -68,6 +69,11 @@
* Both classic TIFF and BigTIFF containers (allowed for DNG since spec
* version 1.7) are supported for preview extraction; for BigTIFF, EXIF
* metadata extraction is skipped until metadata-extractor supports it.
+ * <p>
+ * The largest preview is marked
+ * {@link TikaCoreProperties.EmbeddedResourceType#THUMBNAIL}, any smaller
+ * ones are {@link TikaCoreProperties.EmbeddedResourceType#INLINE} images
+ * (TIKA-4851).
Review Comment:
Reworded: the rule applies to the previews that are actually extracted, and
the size is the JPEG byte length.
##########
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-image-module/src/test/java/org/apache/tika/parser/image/RawTiffParserTest.java:
##########
@@ -43,12 +43,27 @@ private List<Metadata> parseByName(String fileName) throws
Exception {
return getRecursiveMetadata(fileName, metadata);
}
- private void assertPreview(Metadata preview, int index, int width, int
height) {
+ /**
+ * The largest preview: the file's thumbnail, always emitted first.
+ */
Review Comment:
Reworded accordingly.
> RawTiffParser: mark only the largest JPEG preview as THUMBNAIL
> --------------------------------------------------------------
>
> Key: TIKA-4851
> URL: https://issues.apache.org/jira/browse/TIKA-4851
> Project: Tika
> Issue Type: New Feature
> Reporter: Dominik Schmidt
> Priority: Major
>
> RawTiffParser (TIKA-4824) emits every JPEG preview found in the IFD chain and
> SubIFDs as an embedded document with tk:embedded-resource-type=THUMBNAIL, in
> IFD walk order. A NEF typically carries a 160x120 thumbnail in IFD0 and a
> full-size preview in a SubIFD, DNG and CR2 similar, so the first THUMBNAIL is
> usually the smallest one. A client that wants the representative image has to
> parse the dimensions of every preview and pick the largest, which is a
> format-specific special case again; every other parser that emits THUMBNAIL
> emits exactly one.
> Proposal:
> - Only the largest preview (by JPEG byte length, or by the IFD's
> ImageWidth/ImageLength when present) is marked THUMBNAIL and emitted first.
> - The remaining previews are still extracted, marked INLINE (they are
> renderings of the same image, not attachments), keeping the current
> thumbnail_N generated names or switching the smaller ones to an image_N
> prefix.
> Motivation for both tickets: a generic "first THUMBNAIL is the preview" rule
> across all formats in a downstream consumer (OpenCloud's Tika extractor).
--
This message was sent by Atlassian Jira
(v8.20.10#820010)