You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tika.apache.org by ta...@apache.org on 2020/09/08 15:39:38 UTC

[tika] branch branch_1x updated: TIKA-3193 -- add mime detection for avif

This is an automated email from the ASF dual-hosted git repository.

tallison pushed a commit to branch branch_1x
in repository https://gitbox.apache.org/repos/asf/tika.git


The following commit(s) were added to refs/heads/branch_1x by this push:
     new 9527fd7  TIKA-3193 -- add mime detection for avif
9527fd7 is described below

commit 9527fd7cc90119df5b703c092a4a6d58546d4314
Author: tallison <ta...@apache.org>
AuthorDate: Tue Sep 8 11:39:13 2020 -0400

    TIKA-3193 -- add mime detection for avif
---
 .../resources/org/apache/tika/mime/tika-mimetypes.xml     |  12 +++++++++++-
 .../src/test/java/org/apache/tika/mime/TestMimeTypes.java |   8 ++++++++
 .../src/test/resources/test-documents/testAVIF.avif       | Bin 0 -> 185 bytes
 3 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml b/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml
index cbef553..a92ab22 100644
--- a/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml
+++ b/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml
@@ -5643,7 +5643,17 @@
     </magic>
     <glob pattern="*.webp"/>
   </mime-type>
-
+  <mime-type type="image/avif">
+    <!-- According to https://github.com/libvips/libvips/pull/1657
+      older avif used to use the the heif 'ftypmif1' as well -->
+    <_comment>AV1 Image File</_comment>
+    <acronym>AVIF</acronym>
+    <tika:link>https://en.wikipedia.org/wiki/AV1#AV1_Image_File_Format_(AVIF)</tika:link>
+    <magic priority="60">
+      <match value="ftypavif" type="string" offset="4"/>
+    </magic>
+    <glob pattern="*.avif"/>
+  </mime-type>
   <mime-type type="image/heic">
     <tika:link>https://en.wikipedia.org/wiki/High_Efficiency_Image_File_Format</tika:link>
     <magic priority="50">
diff --git a/tika-parsers/src/test/java/org/apache/tika/mime/TestMimeTypes.java b/tika-parsers/src/test/java/org/apache/tika/mime/TestMimeTypes.java
index 048acdd..d05d080 100644
--- a/tika-parsers/src/test/java/org/apache/tika/mime/TestMimeTypes.java
+++ b/tika-parsers/src/test/java/org/apache/tika/mime/TestMimeTypes.java
@@ -430,6 +430,14 @@ public class TestMimeTypes {
     }
 
     @Test
+    public void testAVIFDetection() throws Exception {
+        // The test file is an avif header fragment only, not a complete image.
+        assertType("image/avif", "testAVIF.avif");
+        assertTypeByData("image/avif", "testAVIF.avif");
+        assertTypeByName("image/avif", "testAVIF.avif");
+    }
+
+    @Test
     public void testHeifDetection() throws Exception {
         // HEIF image using the HEVC Codec == HEIC
         //  created using https://compare.rokka.io/_compare on testJPEG_GEO.jpg
diff --git a/tika-parsers/src/test/resources/test-documents/testAVIF.avif b/tika-parsers/src/test/resources/test-documents/testAVIF.avif
new file mode 100644
index 0000000..359474c
Binary files /dev/null and b/tika-parsers/src/test/resources/test-documents/testAVIF.avif differ