List of usage examples for org.apache.commons.imaging.formats.tiff.constants GpsTagConstants GPS_TAG_GPS_AREA_INFORMATION
TagInfoGpsText GPS_TAG_GPS_AREA_INFORMATION
To view the source code for org.apache.commons.imaging.formats.tiff.constants GpsTagConstants GPS_TAG_GPS_AREA_INFORMATION.
Click Source Link
From source file:net.tourbook.photo.Photo.java
/** * GPS area info/*from w w w. j a v a2s .co m*/ */ private String getExifValueGpsArea(final JpegImageMetadata jpegMetadata) { try { final TiffField field = jpegMetadata .findEXIFValueWithExactMatch(GpsTagConstants.GPS_TAG_GPS_AREA_INFORMATION); if (field != null) { final Object fieldValue = field.getValue(); if (fieldValue != null) { /** * source: Exif 2.2 specification * * <pre> * * Table 6 Character Codes and their Designation * * Character Code Code Designation (8 Bytes) References * ASCII 41.H, 53.H, 43.H, 49.H, 49.H, 00.H, 00.H, 00.H ITU-T T.50 IA5 * JIS A.H, 49.H, 53.H, 00.H, 00.H, 00.H, 00.H, 00.H JIS X208-1990 * Unicode 55.H, 4E.H, 49.H, 43.H, 4F.H, 44.H, 45.H, 00.H Unicode Standard * Undefined 00.H, 00.H, 00.H, 00.H, 00.H, 00.H, 00.H, 00.H Undefined * * </pre> */ final byte[] byteArrayValue = field.getByteArrayValue(); final int fieldLength = byteArrayValue.length; if (fieldLength > 0) { /** * <pre> * * skipping 1 + 6 characters: * * 1 character code * 2...7 have no idea why these bytes are set to none valid characters * * </pre> */ final byte[] valueBytes = Arrays.copyOfRange(byteArrayValue, 7, fieldLength); String valueString = null; final byte firstByte = byteArrayValue[0]; if (firstByte == 0x55) { valueString = new String(valueBytes, UI.UTF_16); } else { valueString = new String(valueBytes); } return valueString; } } } } catch (final Exception e) { // ignore } return null; }