Example usage for org.apache.commons.imaging.formats.tiff TiffField getDoubleArrayValue

List of usage examples for org.apache.commons.imaging.formats.tiff TiffField getDoubleArrayValue

Introduction

In this page you can find the example usage for org.apache.commons.imaging.formats.tiff TiffField getDoubleArrayValue.

Prototype

public double[] getDoubleArrayValue() throws ImageReadException 

Source Link

Usage

From source file:net.mozq.picto.core.ProcessCore.java

private static Double getEXIFDoubleValue(ImageMetadata imageMetadata, TagInfo tagInfo, int index) {
    TiffField field = getTiffField(imageMetadata, tagInfo);
    if (field == null) {
        return null;
    }/*  w w  w .  j  av  a  2  s .co m*/

    Double value;
    try {
        double[] v = field.getDoubleArrayValue();
        if (v == null) {
            value = null;
        } else {
            value = Double.valueOf(v[index]);
        }
    } catch (ImageReadException e) {
        value = null;
    }

    return value;
}

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  w w.  j  a v  a 2  s .co m
            }
        }
    }
    return null;
}