flutter_image_compress
flutter_image_compress copied to clipboard
Exif data on Android gets lost even with keepExif = true
On Android we seem to lose a lot of exif data from a picture when compressing it, even with keepExif: true
.
Example
before scaling:
{Image ImageWidth: 4032, Image ImageLength: 3024, Image Make: samsung, Image Model: SM-G970F, Image Orientation: Rotated 90 CW, Image XResolution: 72, Image YResolution: 72, Image ResolutionUnit: Pixels/Inch, Image Software: G970FXXU8DTH7, Image DateTime: 2020:09:16 16:54:42, Image YCbCrPositioning: Centered, Image ExifOffset: 238, GPS GPSLatitudeRef: N, GPS GPSLatitude: [51, 8, 1321017/25000], GPS GPSLongitudeRef: E, GPS GPSLongitude: [4, 26, 119523/12500], Image GPSInfo: 656, Thumbnail ImageWidth: 512, Thumbnail ImageLength: 384, Thumbnail Compression: JPEG (old-style), Thumbnail XResolution: 72, Thumbnail YResolution: 72, Thumbnail ResolutionUnit: Pixels/Inch, Thumbnail JPEGInterchangeFormat: 876, Thumbnail JPEGInterchangeFormatLength: 58490, EXIF ExposureTime: 1/100, EXIF FNumber: 12/5, EXIF ExposureProgram: Program Normal, EXIF ISOSpeedRatings: 50, EXIF ExifVersion: 0220, EXIF DateTimeOriginal: 2020:09:16 16:54:42, EXIF DateTimeDigitized: 2020:09:16 16:54:42, EXIF ShutterSpeedValue: 1/100, EXIF Aperture ....
after scaling:
{Image ImageWidth: 2064, Image ImageLength: 2752, Image ExifOffset: 62, Image Orientation: 0, EXIF LightSource: Unknown}
Flutter version: Channel stable, 1.20.4
We see it happen on devices from different vendors, different Android versions, ...
The part of code copy from flutter team. It seems that there are restrictions on the retention of tags.
This should be fixed in this PR: https://github.com/OpenFlutter/flutter_image_compress/pull/161 @CaiJingLong