List of usage examples for org.apache.commons.imaging.formats.tiff.constants GpsTagConstants GPS_TAG_GPS_DEST_BEARING_REF_VALUE_TRUE_NORTH
String GPS_TAG_GPS_DEST_BEARING_REF_VALUE_TRUE_NORTH
To view the source code for org.apache.commons.imaging.formats.tiff.constants GpsTagConstants GPS_TAG_GPS_DEST_BEARING_REF_VALUE_TRUE_NORTH.
Click Source Link
From source file:it.inserpio.mapillary.gopro.importer.exif.EXIFPropertyWriter.java
public static void setExifGPSTag(File jpegImageFile, File jpegImageOutputFile, Coordinates coordinates) throws IOException, ImageReadException, ImageWriteException { OutputStream os = null;/*from w w w .jav a2s . c om*/ boolean canThrow = false; try { TiffOutputSet outputSet = null; final IImageMetadata metadata = Imaging.getMetadata(jpegImageFile); final JpegImageMetadata jpegMetadata = (JpegImageMetadata) metadata; if (jpegMetadata != null) { final TiffImageMetadata exif = jpegMetadata.getExif(); if (exif != null) { outputSet = exif.getOutputSet(); } } if (outputSet == null) { outputSet = new TiffOutputSet(); } outputSet.setGPSInDegrees(coordinates.getLongitude(), coordinates.getLatitude()); outputSet.getGPSDirectory().removeField(GpsTagConstants.GPS_TAG_GPS_IMG_DIRECTION_REF); outputSet.getGPSDirectory().add(GpsTagConstants.GPS_TAG_GPS_IMG_DIRECTION_REF, GpsTagConstants.GPS_TAG_GPS_DEST_BEARING_REF_VALUE_TRUE_NORTH); outputSet.getGPSDirectory().removeField(GpsTagConstants.GPS_TAG_GPS_IMG_DIRECTION); outputSet.getGPSDirectory().add(GpsTagConstants.GPS_TAG_GPS_IMG_DIRECTION, new RationalNumber[] { RationalNumber.valueOf(coordinates.getDirection()) }); //outputSet.getRootDirectory().removeField(305); os = new FileOutputStream(jpegImageOutputFile); os = new BufferedOutputStream(os); new ExifRewriter().updateExifMetadataLossless(jpegImageFile, os, outputSet); canThrow = true; } finally { IoUtils.closeQuietly(canThrow, os); } }