Example usage for org.apache.commons.imaging ImageReadException getMessage

List of usage examples for org.apache.commons.imaging ImageReadException getMessage

Introduction

In this page you can find the example usage for org.apache.commons.imaging ImageReadException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:net.consulion.jeotag.PhotoLoader.java

private static Boolean photoHasGeotag(final TiffImageMetadata exif, final File file) {
    Boolean hasGeoTag = false;/*  w  w w.ja  v  a 2  s . co m*/
    try {
        final TiffImageMetadata.GPSInfo gps = exif.getGPS();
        if (gps != null && gps.getLatitudeAsDegreesNorth() != 0 && gps.getLongitudeAsDegreesEast() != 0) {
            hasGeoTag = Boolean.TRUE;
        }
    } catch (ImageReadException ex) {
        Logger.getLogger(PhotoLoader.class.getName()).log(Level.FINE, null,
                String.format("File: %s couldn't be read. Cause: %s", file.getPath(), ex.getMessage()));
    }
    return hasGeoTag;
}

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

public Coordinates getCoordinates() {
    if (!fetchedCoordinates) {
        fetchedCoordinates = true;//www  .j  a  v a2s  .  c  om
        try {
            extractGpsData();
        } catch (ImageReadException e) {
            logger.severe("Could not get gps data from file '" + pictureFile + "': " + e.getMessage());
        }
    }

    return coordinates;
}

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