Package com.drew.metadata.exif

Examples of com.drew.metadata.exif.ExifReader


                segmentReader = new JpegSegmentReader(new ByteArrayInputStream(b));

                byte[] exifSegment = segmentReader.readSegment(JpegSegmentReader.SEGMENT_APP1);
                byte[] iptcSegment = segmentReader.readSegment(JpegSegmentReader.SEGMENT_APPD);
                Metadata metadata = new Metadata();
                new ExifReader(exifSegment).extract(metadata);
                new IptcReader(iptcSegment).extract(metadata);
               
                @SuppressWarnings("unchecked")
                Iterator<Directory> directories = metadata.getDirectoryIterator();
                HashMap<String, String> props = new HashMap<String, String>();
View Full Code Here


    }

    public Date readOriginalTime(File jpeg) throws IOException, ParseException{
        String dateString = null;
        try{
            Metadata meta = (new ExifReader(jpeg)).extract();
            ExifDirectory exif = (ExifDirectory) meta.getDirectory(ExifDirectory.class);
            dateString = exif.getString(ExifDirectory.TAG_DATETIME_ORIGINAL);
        } catch (JpegProcessingException ex){
            throw toIOException(ex, jpeg);
        }
View Full Code Here

    }

    public Wpt readGPSTag(File jpeg) throws IOException, ParseException{
        Wpt result = null;
        try{
            Metadata meta = (new ExifReader(jpeg)).extract();
            boolean hasGpsDirectory = meta.containsDirectory(GpsDirectory.class);
            if(hasGpsDirectory){
                GpsDirectory gps = (GpsDirectory) meta.getDirectory(GpsDirectory.class);
                if(gps.hasErrors()){
                    System.err.println("Warning: GPS directory has errors");
View Full Code Here

    }

    public void testWindowsXpFields() throws Exception
    {
        String fileName = "src/com/drew/metadata/exif/test/windowsXpFields.jpg";
        Metadata metadata = new ExifReader(new File(fileName)).extract();
        Directory directory = metadata.getDirectory(ExifDirectory.class);
        ExifDescriptor descriptor = new ExifDescriptor(directory);
        assertEquals("Testing artist", descriptor.getDescription(ExifDirectory.TAG_WIN_AUTHOR));
        assertEquals("Testing comments", descriptor.getDescription(ExifDirectory.TAG_WIN_COMMENT));
        assertEquals("Testing keywords", descriptor.getDescription(ExifDirectory.TAG_WIN_KEYWORDS));
View Full Code Here

    }

    protected void setUp() throws Exception
    {
        File metadataFile = new File("src/com/drew/metadata/exif/test/nikonMakernoteType2a.metadata");
        Metadata metadata = new ExifReader(JpegSegmentData.FromFile(metadataFile)).extract();

        _nikonDirectory = (NikonType2MakernoteDirectory)metadata.getDirectory(NikonType2MakernoteDirectory.class);
        _descriptor = new NikonType2MakernoteDescriptor(_nikonDirectory);
    }
View Full Code Here

    }

    public void testLoadFujiFilmJpeg() throws Exception
    {
        String jpegWithExif = "src/com/drew/metadata/exif/test/withExif.jpg";
        Metadata metadata = new ExifReader(new File(jpegWithExif)).extract();
        Directory directory = metadata.getDirectory(ExifDirectory.class);
        assertEquals("80", directory.getDescription(ExifDirectory.TAG_ISO_EQUIVALENT));
        // TODO decide if this should still be returned -- it was being calculated upon setting of a related tag
//      assertEquals("F9", directory.getDescription(ExifDirectory.TAG_APERTURE));
    }
View Full Code Here

    }

    public void testLoadJpegWithoutExifData() throws Exception
    {
        String jpegNoExif = "src/com/drew/metadata/exif/test/noExif.jpg";
        Metadata metadata = new ExifReader(new File(jpegNoExif)).extract();
        assertTrue(!metadata.containsDirectory(ExifDirectory.class));
    }
View Full Code Here

    {
        // This test used to ensure an exception was thrown when loading a particular jpeg
        // The intention has since changed, and the API should only throw exceptions in completely
        // fatal situations.  Now, the Metadata object returned has no new tags.
        String jpegBadExif = "src/com/drew/metadata/exif/test/badExif.jpg"; // Exif data segment doesn't begin with 'Exif'
        Metadata metadata = new ExifReader(new File(jpegBadExif)).extract();
        assertEquals(0, metadata.getDirectory(ExifDirectory.class).getTagCount());
    }
View Full Code Here

    {
        // this image was created via a resize in ACDSee
        // it seems to have a reference to an IFD starting outside the data segment
        // i've noticed that ACDSee reports a Comment for this image, yet ExifReader doesn't report one
        String fileName = "src/com/drew/metadata/exif/test/crash01.jpg";
        Metadata metadata = new ExifReader(new File(fileName)).extract();
        assertTrue(metadata.getDirectory(ExifDirectory.class).getTagCount() > 0);
    }
View Full Code Here

    }

    public void testThumbnailOffset() throws Exception
    {
        String fileName = "src/com/drew/metadata/exif/test/manuallyAddedThumbnail.jpg";
        Metadata metadata = new ExifReader(new File(fileName)).extract();
        Directory directory = metadata.getDirectory(ExifDirectory.class);
        assertEquals(192, directory.getInt(ExifDirectory.TAG_THUMBNAIL_OFFSET));
    }
View Full Code Here

TOP

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

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.