Open
Description
When trying to preserve exif for an image that has been edited with software Snapseed on Android, the compression fails.
The error message is Orientation data type is invalid
, and the error is thrown in the following code of copyExifWithoutOrientation.js
:
for (
let i = tiffOffset + ifd0Offset + 2;
i < endOfTagsOffset;
i += 12
) {
const tagId = view.getUint16(i, littleEndian);
if (tagId == TAG_ID_ORIENTATION) {
if (view.getUint16(i + 2, littleEndian) !== TAG_TYPE_SHORT) { return reject('Orientation data type is invalid'); }
if (view.getUint32(i + 4, littleEndian) !== 1) { return reject('Orientation data count is invalid'); }
view.setUint16(i + 8, 1, littleEndian);
break;
}
}
Linking an exemple of failing picture, you can see it fail on the demo with version >= 2.0.1.
I don't know if it happens with other editing softwares, or if this is something Snapseed does wrong.
But my suggestion is to try and make this library more resilient, and to not fail the compression if the orientation part did not go as planned
Metadata
Metadata
Assignees
Labels
No labels