[
https://issues.apache.org/jira/browse/TIKA-4870?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18110725#comment-18110725
]
ASF GitHub Bot commented on TIKA-4870:
--------------------------------------
dschmidt commented on code in PR #3116:
URL: https://github.com/apache/tika/pull/3116#discussion_r3915915376
##########
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-image-module/src/main/java/org/apache/tika/parser/image/HeifParser.java:
##########
@@ -41,7 +41,8 @@ public class HeifParser extends AbstractImageParser {
private static final Set<MediaType> SUPPORTED_TYPES = new HashSet<>(
Arrays.asList(MediaType.image("heif"),
MediaType.image("heif-sequence"),
- MediaType.image("heic"),
MediaType.image("heic-sequence")));
+ MediaType.image("heic"), MediaType.image("heic-sequence"),
+ MediaType.image("avif")));
Review Comment:
Done in 7cf014a27d, which also matches BPGParser, PSDParser and
RawTiffParser.
##########
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-image-module/src/main/java/org/apache/tika/parser/image/HeifParser.java:
##########
@@ -41,7 +41,8 @@ public class HeifParser extends AbstractImageParser {
private static final Set<MediaType> SUPPORTED_TYPES = new HashSet<>(
Arrays.asList(MediaType.image("heif"),
MediaType.image("heif-sequence"),
- MediaType.image("heic"),
MediaType.image("heic-sequence")));
+ MediaType.image("heic"), MediaType.image("heic-sequence"),
+ MediaType.image("avif")));
Review Comment:
There is no `image/avif-sequence` in tika-mimetypes.xml, so this would claim
a type nothing hands out. Naming it is the open question in TIKA-4509, between
`image/avif-sequence` and `image/avif;format=sequence`; claiming one of them
here would settle that by accident. Once the type exists, the parser should
take it.
##########
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-image-module/src/test/java/org/apache/tika/parser/image/HeifParserTest.java:
##########
@@ -84,4 +85,25 @@ public void testAppleLivePhotoMakerNote() throws Exception {
}
}
+ /*
+ testAVIF_XMP.avif is a 32x32 gradient encoded with libavif through
+ ImageMagick, with an XMP packet attached: AVIF is the same ISO-BMFF
+ container, so the same parser reads it (TIKA-4870).
+ */
+ @Test
+ public void testAvif() throws Exception {
+ Metadata metadata = new Metadata();
+ try (TikaInputStream tis =
getResourceAsStream("/test-documents/testAVIF_XMP.avif")) {
+ parser.parse(tis, new DefaultHandler(), metadata, new
ParseContext());
+
+ assertEquals("image/avif", metadata.get(HttpHeaders.CONTENT_TYPE));
+ assertEquals("avif",
metadata.get(ImageMetadataExtractor.UNKNOWN_IMG_NS + "Major Brand"));
+ assertEquals("32 pixels",
metadata.get(ImageMetadataExtractor.UNKNOWN_IMG_NS + "Width"));
+ assertEquals("32 pixels",
metadata.get(ImageMetadataExtractor.UNKNOWN_IMG_NS + "Height"));
+ //the XMP item is found through meta/iinf/iloc, as it is for HEIC
+ assertEquals("AVIF XMP Title",
metadata.get(TikaCoreProperties.TITLE));
+ assertEquals("Jane Photographer",
metadata.get(TikaCoreProperties.CREATOR));
Review Comment:
Kept as `get`, the way the two HEIC tests next to it read. The fixture
declares exactly one creator, so the first value is the whole expectation; the
multi-valued mapping itself is XmpExtractorTest's job.
> HeifParser should accept image/avif
> -----------------------------------
>
> Key: TIKA-4870
> URL: https://issues.apache.org/jira/browse/TIKA-4870
> Project: Tika
> Issue Type: Improvement
> Reporter: Dominik Schmidt
> Priority: Major
>
> AVIF files reach no parser today. HeifParser claims image/heif,
> image/heif-sequence, image/heic and image/heic-sequence, nothing else in
> tika-parsers claims image/avif, and its mime entry declares no sub-class-of
> image/heif, so an AVIF is detected and then handed to no one: no dimensions,
> no EXIF, no XMP. Detection was added in TIKA-3193 and nothing ever picked it
> up for parsing.
> The container is the same ISO-BMFF and the metadata sits in the same places.
> HeifXmp locates XMP generically through meta/iinf/iloc, which is where AVIF
> puts it as well, and metadata-extractor reads HEIF item properties for AVIF
> too, so adding MediaType.image("avif") to the parser's supported types is
> most of the work; what it needs is a fixture and a check of which properties
> actually come out.
> Once that is in, the Motion Photo work from TIKA-4869 should be checked
> against it: AVIF is one of the three primary image formats the Motion Photo
> format allows, alongside JPEG and HEIC, and its video sits in the same
> trailing mpvd box, so the same code should emit it. There is no test for that
> today.
> Detection of animated AVIF is a separate question and is tracked in TIKA-4509.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)