Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exif orientation invalid for a jpeg edited with Snapseed #187

Open
obr-09 opened this issue Apr 11, 2023 · 0 comments
Open

Exif orientation invalid for a jpeg edited with Snapseed #187

obr-09 opened this issue Apr 11, 2023 · 0 comments

Comments

@obr-09
Copy link

obr-09 commented Apr 11, 2023

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.
jpegEditedWithSnapseed


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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant