Examples of containsDirectory()


Examples of com.drew.metadata.Metadata.containsDirectory()

   */
  public static boolean fillExifInfo(String img_path, Photo photo){
    //Reading EXIF
    try {
      Metadata metadata = JpegMetadataReader.readMetadata(new File(img_path));
      if(!metadata.containsDirectory(ExifDirectory.class))
        return false;
      Directory exif = metadata.getDirectory(ExifDirectory.class);
      if(exif!=null){
        if(exif.containsTag(ExifDirectory.TAG_ORIENTATION))
          photo.setOrientation(exif.getInt(ExifDirectory.TAG_ORIENTATION));
View Full Code Here

Examples of com.drew.metadata.Metadata.containsDirectory()

           
            File jpegFile = new File(filename);
           
            try {
                Metadata metadata = JpegMetadataReader.readMetadata(jpegFile);
                if (metadata.containsDirectory(ExifDirectory.class)) {
                    Directory exifDirectory = metadata.getDirectory(ExifDirectory.class);
                   
                    try {
                        String camera = exifDirectory.getString(ExifDirectory.TAG_MODEL);
                        image.setValue(Image._Q_CAMERA, camera);
View Full Code Here

Examples of com.drew.metadata.Metadata.containsDirectory()

                            image.setValue(Image._N_DATE, cal.getTime());
                        }
                    } catch (Exception me) {}
                }
               
                if (metadata.containsDirectory(IptcDirectory.class)) {
                    try {
                        Directory iptcDirectory = metadata.getDirectory(IptcDirectory.class);
                        String city = iptcDirectory.getString(IptcDirectory.TAG_CITY);
                        String country = iptcDirectory.getString(IptcDirectory.TAG_COUNTRY_OR_PRIMARY_LOCATION);
                        String state = iptcDirectory.getString(IptcDirectory.TAG_PROVINCE_OR_STATE);
View Full Code Here

Examples of com.drew.metadata.Metadata.containsDirectory()

    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");
                    java.util.Iterator it = gps.getErrors();
View Full Code Here

Examples of com.drew.metadata.Metadata.containsDirectory()

    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));
    }

    public void testLoadJpegWithBadExifData() throws Exception
    {
        // This test used to ensure an exception was thrown when loading a particular jpeg
View Full Code Here

Examples of com.drew.metadata.Metadata.containsDirectory()

    {
        // use a known testing image
        File jpegFile = new File("src/com/drew/metadata/jpeg/test/simple.jpg");
        JpegReader reader = new JpegReader(jpegFile);
        Metadata metadata = reader.extract();
        assertTrue(metadata.containsDirectory(JpegDirectory.class));
        _directory = (JpegDirectory)metadata.getDirectory(JpegDirectory.class);
    }

    public void testExtract_Width() throws Exception
    {
View Full Code Here

Examples of com.drew.metadata.Metadata.containsDirectory()

    public void testExtractMetadata() throws Exception
    {
        File withExif = new File("src/com/drew/metadata/exif/test/withExif.jpg");
        Metadata metadata = JpegMetadataReader.readMetadata(withExif);
        assertTrue(metadata.containsDirectory(ExifDirectory.class));
        Directory directory = metadata.getDirectory(ExifDirectory.class);
        assertEquals("80", directory.getString(ExifDirectory.TAG_ISO_EQUIVALENT));
    }

    public void testExtractMetadataUsingInputStream() throws Exception
View Full Code Here

Examples of com.drew.metadata.Metadata.containsDirectory()

    public void testExtractMetadataUsingInputStream() throws Exception
    {
        File withExif = new File("src/com/drew/metadata/exif/test/withExif.jpg");
        InputStream in = new BufferedInputStream(new FileInputStream((withExif)));
        Metadata metadata = JpegMetadataReader.readMetadata(in);
        assertTrue(metadata.containsDirectory(ExifDirectory.class));
        Directory directory = metadata.getDirectory(ExifDirectory.class);
        assertEquals("80", directory.getString(ExifDirectory.TAG_ISO_EQUIVALENT));
    }
}
View Full Code Here

Examples of com.drew.metadata.Metadata.containsDirectory()

            new ObjectOutputStream(new FileOutputStream(ser)).writeObject(metadataWrite);
            // read the ser object
            metadataRead = (Metadata)new ObjectInputStream(new FileInputStream(ser)).readObject();
            // make sure they're equivalent
            // TODO should compare the two objects via iteration of directories and tags
            assertTrue(metadataRead.containsDirectory(ExifDirectory.class));
            assertTrue(metadataRead.containsDirectory(IptcDirectory.class));
        } finally {
            ser.delete();
        }
    }
View Full Code Here

Examples of com.drew.metadata.Metadata.containsDirectory()

            // read the ser object
            metadataRead = (Metadata)new ObjectInputStream(new FileInputStream(ser)).readObject();
            // make sure they're equivalent
            // TODO should compare the two objects via iteration of directories and tags
            assertTrue(metadataRead.containsDirectory(ExifDirectory.class));
            assertTrue(metadataRead.containsDirectory(IptcDirectory.class));
        } finally {
            ser.delete();
        }
    }
}
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.