Package com.drew.metadata.exif

Examples of com.drew.metadata.exif.ExifSubIFDDirectory


            {
                this.file = file;
                this.metadata = metadata;

                ExifIFD0Directory ifd0Dir = metadata.getDirectory(ExifIFD0Directory.class);
                ExifSubIFDDirectory subIfdDir = metadata.getDirectory(ExifSubIFDDirectory.class);
                ExifThumbnailDirectory thumbDir = metadata.getDirectory(ExifThumbnailDirectory.class);
                if (ifd0Dir != null) {
                    manufacturer = ifd0Dir.getDescription(ExifIFD0Directory.TAG_MAKE);
                    model = ifd0Dir.getDescription(ExifIFD0Directory.TAG_MODEL);
                }
                boolean hasMakernoteData = false;
                if (subIfdDir != null) {
                    exifVersion = subIfdDir.getDescription(ExifSubIFDDirectory.TAG_EXIF_VERSION);
                    hasMakernoteData = subIfdDir.containsTag(ExifSubIFDDirectory.TAG_MAKERNOTE);
                }
                if (thumbDir != null) {
                    Integer width = thumbDir.getInteger(ExifThumbnailDirectory.TAG_THUMBNAIL_IMAGE_WIDTH);
                    Integer height = thumbDir.getInteger(ExifThumbnailDirectory.TAG_THUMBNAIL_IMAGE_HEIGHT);
                    thumbnail = width != null && height != null
View Full Code Here


    @Test
    public void testHasErrors() throws Exception
    {
        Metadata metadata = new Metadata();
        assertFalse(metadata.hasErrors());
        final ExifSubIFDDirectory directory = metadata.getOrCreateDirectory(ExifSubIFDDirectory.class);
        directory.addError("Test Error 1");
        assertTrue(metadata.hasErrors());
    }
View Full Code Here

    @Test
    public void testGetErrors() throws Exception
    {
        Metadata metadata = new Metadata();
        assertFalse(metadata.hasErrors());
        final ExifSubIFDDirectory directory = metadata.getOrCreateDirectory(ExifSubIFDDirectory.class);
        directory.addError("Test Error 1");
        assertTrue(metadata.hasErrors());
    }
View Full Code Here

    @Test
    public void testHasErrors() throws Exception
    {
        Metadata metadata = new Metadata();
        Assert.assertFalse(metadata.hasErrors());
        final ExifSubIFDDirectory directory = metadata.getOrCreateDirectory(ExifSubIFDDirectory.class);
        directory.addError("Test Error 1");
        Assert.assertTrue(metadata.hasErrors());
    }
View Full Code Here

    @Test
    public void testGetErrors() throws Exception
    {
        Metadata metadata = new Metadata();
        Assert.assertFalse(metadata.hasErrors());
        final ExifSubIFDDirectory directory = metadata.getOrCreateDirectory(ExifSubIFDDirectory.class);
        directory.addError("Test Error 1");
        Assert.assertTrue(metadata.hasErrors());
    }
View Full Code Here

        assertFalse(new ImageMetadataExtractor.ExifHandler().supports(Directory.class));
        assertFalse(new ImageMetadataExtractor.ExifHandler().supports(JpegCommentDirectory.class));
    }
   
    public void testExifHandlerParseDate() throws MetadataException {
        ExifSubIFDDirectory exif = mock(ExifSubIFDDirectory.class);
        when(exif.containsTag(ExifSubIFDDirectory.TAG_DATETIME_ORIGINAL)).thenReturn(true);
        when(exif.getDate(ExifSubIFDDirectory.TAG_DATETIME_ORIGINAL)).thenReturn(
                new GregorianCalendar(2000, 0, 1, 0, 0, 0).getTime()); // jvm default timezone as in Metadata Extractor
        Metadata metadata = new Metadata();
       
        new ImageMetadataExtractor.ExifHandler().handle(exif, metadata);
        assertEquals("Should be ISO date without time zone", "2000-01-01T00:00:00",
View Full Code Here

        assertFalse(new ImageMetadataExtractor.ExifHandler().supports(JpegCommentDirectory.class));
    }
   
    @Test
    public void testExifHandlerParseDate() throws MetadataException {
        ExifSubIFDDirectory exif = mock(ExifSubIFDDirectory.class);
        when(exif.containsTag(ExifSubIFDDirectory.TAG_DATETIME_ORIGINAL)).thenReturn(true);
        GregorianCalendar calendar = new GregorianCalendar(TimeZone.getDefault(), Locale.ROOT);
        calendar.setTimeInMillis(0);
        calendar.set(2000, 0, 1, 0, 0, 0);
        when(exif.getDate(ExifSubIFDDirectory.TAG_DATETIME_ORIGINAL)).thenReturn(
                calendar.getTime()); // jvm default timezone as in Metadata Extractor
        Metadata metadata = new Metadata();
       
        new ImageMetadataExtractor.ExifHandler().handle(exif, metadata);
        assertEquals("Should be ISO date without time zone", "2000-01-01T00:00:00",
View Full Code Here

            Collection<BlackboardAttribute> attributes = new ArrayList<>();
            Metadata metadata = ImageMetadataReader.readMetadata(bin, true);

            // Date
            ExifSubIFDDirectory exifDir = metadata.getDirectory(ExifSubIFDDirectory.class);
            if (exifDir != null) {
                Date date = exifDir.getDate(ExifSubIFDDirectory.TAG_DATETIME_ORIGINAL);
                if (date != null) {
                    attributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DATETIME_CREATED.getTypeID(), ExifParserModuleFactory.getModuleName(), date.getTime() / 1000));
                }
            }
View Full Code Here

TOP

Related Classes of com.drew.metadata.exif.ExifSubIFDDirectory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.