Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
Release 4.1.0 - unreleased

* AVIF images are parsed rather than only detected: HeifParser accepts
image/avif, which is the same ISO-BMFF container, so dimensions, EXIF
and XMP come out of it the way they do for HEIC (TIKA-4870).

* The video of a Google/Android motion photo, appended after the image and
described by the Motion Photo or MicroVideo XMP, is emitted as an
ATTACHMENT embedded document named after what the file declares it to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.io.InputStream;
import java.nio.file.Files;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

Expand All @@ -39,9 +40,10 @@
@TikaComponent
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")));
private static final Set<MediaType> SUPPORTED_TYPES = Collections.unmodifiableSet(
new HashSet<>(Arrays.asList(MediaType.image("heif"), MediaType.image("heif-sequence"),
MediaType.image("heic"), MediaType.image("heic-sequence"),
MediaType.image("avif"))));

@Override
public Set<MediaType> getSupportedTypes(ParseContext context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.apache.tika.metadata.Geographic;
import org.apache.tika.metadata.HttpHeaders;
import org.apache.tika.metadata.Metadata;
import org.apache.tika.metadata.TikaCoreProperties;
import org.apache.tika.parser.AutoDetectParser;
import org.apache.tika.parser.ParseContext;
import org.apache.tika.parser.Parser;
Expand Down Expand Up @@ -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));
Comment thread
dschmidt marked this conversation as resolved.
}
}

}
Binary file not shown.