Package org.apache.sanselan.formats.tiff

Examples of org.apache.sanselan.formats.tiff.TiffField


      for (int j = 0; j < oldFieldTags.size(); j++)
      {
        Integer fieldTag = (Integer) oldFieldTags.get(j);

        TiffField oldField = (TiffField) oldFieldMap.get(fieldTag);
        TiffField newField = (TiffField) newFieldMap.get(fieldTag);

        //        Debug.debug("fieldTag", fieldTag);
        //        Debug.debug("oldField", oldField);
        //        Debug.debug("newField", newField);

        //        fieldTag.
        assertNotNull(oldField);
        assertNotNull(newField);

        assertEquals(oldField.tag, newField.tag);
        assertEquals(dirType.intValue(), newField.directoryType);
        assertEquals(oldField.directoryType, newField.directoryType);
        assertEquals(oldField.length, newField.length);
        assertEquals(oldField.isLocalValue(), newField.isLocalValue());

        if (oldField.tag == 0x202)
        {
          // ignore "jpg from raw length" value. may have off-by-one bug in certain cameras.
          // i.e. Sony DCR-PC110
          continue;
        }

        if (!oldField.tagInfo.isOffset())
        {
          if (oldField.tagInfo.isText())
            ;
          else if (oldField.isLocalValue())
          {
            //            Debug.debug("oldField.tag", oldField.tag);
            //            Debug.debug("newField.tag", newField.tag);
            //            Debug.debug("oldField.tagInfo", oldField.tagInfo);
            //            Debug.debug("newField.tagInfo", newField.tagInfo);
            //            Debug.debug("oldField.fieldType", oldField.fieldType);
            //            Debug.debug("newField.fieldType", newField.fieldType);
            //            Debug.debug("oldField.getBytesLength", oldField
            //                .getBytesLength());
            //            Debug.debug("newField.getBytesLength", newField
            //                .getBytesLength());
            //
            //            Debug.debug("oldField.valueOffsetBytes",
            //                oldField.valueOffsetBytes);
            //            Debug.debug("newField.valueOffsetBytes",
            //                newField.valueOffsetBytes);

            if (oldField.tag == 0x116 || oldField.tag == 0x117)
              compare(oldField, newField);
            else
              compare(oldField.valueOffsetBytes,
                  newField.valueOffsetBytes, oldField
                      .getBytesLength(), newField
                      .getBytesLength());
          }
          else
          {
            //            Debug.debug("oldField.tagInfo", oldField.tagInfo);
View Full Code Here


     * @throws ImageReadException
     * @throws IOException
     */
    private static ImageMetadata getTagValue(JpegImageMetadata jpegMetadata, TagInfo tagInfo) throws ImageReadException, IOException {
        ImageMetadata imageMetadata = null;
        TiffField field = jpegMetadata.findEXIFValue(tagInfo);
        if (field != null) {
            imageMetadata = new ImageMetadata(tagInfo.name, field.getValueDescription());
        }

        return imageMetadata;
    }
View Full Code Here

          System.out.println("  " + "GPS Latitude (Degrees North): " + latitude);
        }
      }

      // more specific example of how to manually access GPS values
      TiffField gpsLatitudeRefField = jpegMetadata
          .findEXIFValue(TiffConstants.GPS_TAG_GPS_LATITUDE_REF);
      TiffField gpsLatitudeField = jpegMetadata
          .findEXIFValue(TiffConstants.GPS_TAG_GPS_LATITUDE);
      TiffField gpsLongitudeRefField = jpegMetadata
          .findEXIFValue(TiffConstants.GPS_TAG_GPS_LONGITUDE_REF);
      TiffField gpsLongitudeField = jpegMetadata
          .findEXIFValue(TiffConstants.GPS_TAG_GPS_LONGITUDE);
      if (gpsLatitudeRefField != null && gpsLatitudeField != null
          && gpsLongitudeRefField != null
          && gpsLongitudeField != null)
      {
        // all of these values are strings.
        String gpsLatitudeRef = (String) gpsLatitudeRefField.getValue();
        RationalNumber gpsLatitude[] = (RationalNumber[]) (gpsLatitudeField
            .getValue());
        String gpsLongitudeRef = (String) gpsLongitudeRefField
            .getValue();
        RationalNumber gpsLongitude[] = (RationalNumber[]) gpsLongitudeField
            .getValue();

        RationalNumber gpsLatitudeDegrees = gpsLatitude[0];
        RationalNumber gpsLatitudeMinutes = gpsLatitude[1];
        RationalNumber gpsLatitudeSeconds = gpsLatitude[2];
View Full Code Here

  }

  private static void printTagValue(JpegImageMetadata jpegMetadata,
      TagInfo tagInfo) throws ImageReadException, IOException
  {
    TiffField field = jpegMetadata.findEXIFValue(tagInfo);
    if (field == null)
      System.out.println(tagInfo.name + ": " + "Not Found.");
    else
      System.out.println(tagInfo.name + ": "
          + field.getValueDescription());
  }
View Full Code Here

            setCodecV("jpg");
            IImageMetadata meta = Sanselan.getMetadata(inputFile.getFile());

            if (meta != null && meta instanceof JpegImageMetadata) {
              JpegImageMetadata jpegmeta = (JpegImageMetadata) meta;
              TiffField tf = jpegmeta.findEXIFValue(TiffConstants.EXIF_TAG_MODEL);

              if (tf != null) {
                setModel(tf.getStringValue().trim());
              }

              tf = jpegmeta.findEXIFValue(TiffConstants.EXIF_TAG_EXPOSURE_TIME);
              if (tf != null) {
                setExposure((int) (1000 * tf.getDoubleValue()));
              }

              tf = jpegmeta.findEXIFValue(TiffConstants.EXIF_TAG_ORIENTATION);
              if (tf != null) {
                setOrientation(tf.getIntValue());
              }

              tf = jpegmeta.findEXIFValue(TiffConstants.EXIF_TAG_ISO);
              if (tf != null) {
                // Galaxy Nexus jpg pictures may contain multiple values, take the first
                int[] isoValues = tf.getIntArrayValue();
                setIso(isoValues[0]);
              }
            }
          } else if (formatName.startsWith("PNG")) {
            setCodecV("png");
View Full Code Here

TOP

Related Classes of org.apache.sanselan.formats.tiff.TiffField

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.