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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]