Example usage for org.apache.commons.imaging.formats.tiff.fieldtypes FieldType getType

List of usage examples for org.apache.commons.imaging.formats.tiff.fieldtypes FieldType getType

Introduction

In this page you can find the example usage for org.apache.commons.imaging.formats.tiff.fieldtypes FieldType getType.

Prototype

public int getType() 

Source Link

Usage

From source file:joachimeichborn.geotag.io.jpeg.PictureMetadataReader.java

private byte[] getTagByteValue(final TagInfo aTagInfo) {
    if (jpegMetadata != null) {
        final TiffField field = jpegMetadata.findEXIFValueWithExactMatch(aTagInfo);
        if (field != null) {
            final FieldType fieldType = field.getFieldType();
            if (fieldType.getType() == FieldType.BYTE.getType()) {
                return field.getByteArrayValue();
            }/*from  w  w  w  .  j av a 2s.  c o m*/
        }
    }
    return null;
}

From source file:joachimeichborn.geotag.io.jpeg.PictureMetadataReader.java

private String getTagStringValue(final TagInfo aTagInfo) {
    if (jpegMetadata != null) {
        final TiffField field = jpegMetadata.findEXIFValueWithExactMatch(aTagInfo);
        if (field == null) {
            logger.fine("Field " + aTagInfo + " is null for picture " + pictureFile);
            return null;
        }//w w  w  . j a v a  2  s .  c  om

        final FieldType fieldType = field.getFieldType();
        if (fieldType.getType() == FieldType.ASCII.getType()) {
            try {
                return field.getStringValue();
            } catch (ImageReadException e) {
                logger.fine("Failed to read " + aTagInfo + " from " + pictureFile + ": " + e.getMessage());
            }
        }
    }
    return null;
}

From source file:joachimeichborn.geotag.io.jpeg.PictureMetadataReader.java

private double[] getTagRationalValue(final TagInfo aTagInfo) {
    if (jpegMetadata != null) {
        final TiffField field = jpegMetadata.findEXIFValueWithExactMatch(aTagInfo);
        if (field != null) {
            final FieldType fieldType = field.getFieldType();
            if (fieldType.getType() == FieldType.RATIONAL.getType()) {
                try {
                    return field.getDoubleArrayValue();
                } catch (ImageReadException e) {
                    logger.fine("Failed to read " + aTagInfo + " from " + pictureFile + ": " + e.getMessage());
                }//  w  ww .  j av a 2s  .  co  m
            }
        }
    }
    return null;
}

From source file:joachimeichborn.geotag.io.jpeg.PictureMetadataReader.java

private int[] getTagIntValue(final TagInfo aTagInfo) {
    if (jpegMetadata != null) {
        final TiffField field = jpegMetadata.findEXIFValueWithExactMatch(aTagInfo);
        if (field != null) {
            final FieldType fieldType = field.getFieldType();
            if (fieldType.getType() == FieldType.SHORT.getType()) {
                try {
                    return field.getIntArrayValue();
                } catch (ImageReadException e) {
                    logger.fine("Failed to read " + aTagInfo + " from " + pictureFile + ": " + e.getMessage());
                }//from  w  w  w .j  a va  2 s  .c  o m
            }
        }
    }
    return null;
}