Source:
private static MapillaryImportedImage readImageFrom( final InputStream is, final File f, final LatLon defaultLL ) throws IOException { Object latRef = null; Object lonRef = null; Object lat = null; Object lon = null; Object gpsDir = null; Object dateTime = null; final ImageMetadata meta; try { meta = Imaging.getMetadata(is, null); if (meta instanceof JpegImageMetadata) { final JpegImageMetadata jpegMeta = (JpegImageMetadata) meta; latRef = getTiffFieldValue(jpegMeta, GpsTagConstants.GPS_TAG_GPS_LATITUDE_REF); lonRef = getTiffFieldValue(jpegMeta, GpsTagConstants.GPS_TAG_GPS_LONGITUDE_REF); lat = getTiffFieldValue(jpegMeta, GpsTagConstants.GPS_TAG_GPS_LATITUDE); lon = getTiffFieldValue(jpegMeta, GpsTagConstants.GPS_TAG_GPS_LONGITUDE); gpsDir = getTiffFieldValue(jpegMeta, GpsTagConstants.GPS_TAG_GPS_IMG_DIRECTION); dateTime = getTiffFieldValue(jpegMeta, ExifTagConstants.EXIF_TAG_DATE_TIME_ORIGINAL); } } catch (ImageReadException e) { } final LatLon latLon; if (lat instanceof RationalNumber[] && latRef != null && lon instanceof RationalNumber[] && lonRef != null) { latLon = new LatLon( MapillaryUtils.degMinSecToDouble((RationalNumber[]) lat, latRef.toString()), MapillaryUtils.degMinSecToDouble((RationalNumber[]) lon, lonRef.toString()) ); } else { latLon = defaultLL; } final double ca; if (gpsDir instanceof RationalNumber) { ca = ((RationalNumber) gpsDir).doubleValue(); } else { ca = 0; } FileInputStream nis = new FileInputStream(f); boolean pano = ImageMetaDataUtil.getPanorama(nis); if (dateTime == null) { return new MapillaryImportedImage(latLon, ca, f, pano); } return new MapillaryImportedImage(latLon, ca, f, pano, dateTime.toString()); }

Target:
private static MapillaryImportedImage readImageFrom( final InputStream is, final File f, final LatLon defaultLL ) throws IOException { Object latRef = null; Object lonRef = null; Object lat = null; Object lon = null; Object gpsDir = null; Object dateTime = null; final ImageMetadata meta; try { meta = Imaging.getMetadata(is, null); if (meta instanceof JpegImageMetadata) { final JpegImageMetadata jpegMeta = (JpegImageMetadata) meta; latRef = getTiffFieldValue(jpegMeta, GpsTagConstants.GPS_TAG_GPS_LATITUDE_REF); lonRef = getTiffFieldValue(jpegMeta, GpsTagConstants.GPS_TAG_GPS_LONGITUDE_REF); lat = getTiffFieldValue(jpegMeta, GpsTagConstants.GPS_TAG_GPS_LATITUDE); lon = getTiffFieldValue(jpegMeta, GpsTagConstants.GPS_TAG_GPS_LONGITUDE); gpsDir = getTiffFieldValue(jpegMeta, GpsTagConstants.GPS_TAG_GPS_IMG_DIRECTION); dateTime = getTiffFieldValue(jpegMeta, ExifTagConstants.EXIF_TAG_DATE_TIME_ORIGINAL); } } catch (ImageReadException e) { } final LatLon latLon; if (lat instanceof RationalNumber[] && latRef != null && lon instanceof RationalNumber[] && lonRef != null) { latLon = new LatLon( MapillaryUtils.degMinSecToDouble((RationalNumber[]) lat, latRef.toString()), MapillaryUtils.degMinSecToDouble((RationalNumber[]) lon, lonRef.toString()) ); } else { latLon = defaultLL; } final double ca; if (gpsDir instanceof RationalNumber) { ca = ((RationalNumber) gpsDir).doubleValue(); } else { ca = 0; } boolean pano = ImageMetaDataUtil.isPanorama(f); if (dateTime == null) { return new MapillaryImportedImage(latLon, ca, f, pano); } return new MapillaryImportedImage(latLon, ca, f, pano, dateTime.toString()); }