Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
1.0-alpha2
-
None
-
None
-
Maven Dependency:
<dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-imaging</artifactId> <version>1.0-alpha2</version> </dependency>
MacOS 11.3 using
openjdk version "15.0.2" 2021-01-19 OpenJDK Runtime Environment AdoptOpenJDK (build 15.0.2+7) OpenJDK 64-Bit Server VM AdoptOpenJDK (build 15.0.2+7, mixed mode, sharing)
I've attempted to attach the original image, but upload fails. Do you accept 1.7MB jpegs?
Maven Dependency: <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-imaging</artifactId> <version>1.0-alpha2</version> </dependency> MacOS 11.3 using openjdk version "15.0.2" 2021-01-19 OpenJDK Runtime Environment AdoptOpenJDK (build 15.0.2+7) OpenJDK 64-Bit Server VM AdoptOpenJDK (build 15.0.2+7, mixed mode, sharing) I've attempted to attach the original image, but upload fails. Do you accept 1.7MB jpegs?
Description
Using the below code based on provided sample doesn't just remove the TIFF_TAG_MODEL field, but moves its value to another tag, and further relocates GPS Version ID.
FileUtils.copyFile(src, dst); try (FileOutputStream fos = new FileOutputStream(dst); OutputStream os = new BufferedOutputStream(fos)) { final ImageMetadata metadata = Imaging.getMetadata(src); final JpegImageMetadata jpegMetadata = (JpegImageMetadata) metadata; final TiffImageMetadata exif = jpegMetadata.getExif(); final TiffOutputSet outputSet = exif.getOutputSet(); final TiffOutputDirectory exifDirectory = outputSet.getRootDirectory(); exifDirectory.removeField(TiffTagConstants.TIFF_TAG_MODEL); new ExifRewriter().updateExifMetadataLossless(src, os, outputSet); }
The resultant diff from Exiftool is:
diff a.txt b.txt 2c2 < [System] File Name : a.jpg --- > [System] File Name : b.jpg 5,7c5,7 < [System] File Modification Date/Time : 2021:05:03 09:34:28+00:00 < [System] File Access Date/Time : 2021:05:03 09:34:29+00:00 < [System] File Inode Change Date/Time : 2021:05:03 09:34:28+00:00 --- > [System] File Modification Date/Time : 2021:05:03 09:34:43+00:00 > [System] File Access Date/Time : 2021:05:03 09:34:43+00:00 > [System] File Inode Change Date/Time : 2021:05:03 09:34:43+00:00 23d22 < [IFD0] Camera Model Name : NIKON D90 67d65 < [GPS] GPS Version ID : 2.3.0.0 74c72 < [IFD1] Thumbnail Offset : 1514 --- > [IFD1] Thumbnail Offset : 1372 134a133 > [XMP-exif] GPS Version ID : 2.3.0.0 136a136 > [XMP-tiff] Camera Model Name : NIKON D90
I can not attach the 1.7MB jpeg that has this issue. A smaller lower resolution version of the same image results in different output