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

Set exif orientation #141

Open
NilsOlof opened this issue Jan 5, 2022 · 0 comments
Open

Set exif orientation #141

NilsOlof opened this issue Jan 5, 2022 · 0 comments

Comments

@NilsOlof
Copy link

NilsOlof commented Jan 5, 2022

Thank you for a great library!

I am trying to set the orientation of an image without changing image data:

`

 const imageData = await loadImage(blob, { meta: true });
  loadImage.writeExifData(imageData.imageHead, imageData, "Orientation", 7);
  const resultBlob = await loadImage.replaceHead(blob, imageData.imageHead);

`
The problem is that reading works fine but writing result in the following:

Write: Results in
1: 1
2: 1
3: 3
4: 1
5: 5
6: 1
7: 8
8: 1

So the sample code above results in orientation 8

piexif.js have the same problem.

For reference:

The 8 EXIF orientation values are numbered 1 to 8.

1 = 0 degrees: the correct orientation, no adjustment is required.
2 = 0 degrees, mirrored: image has been flipped back-to-front.
3 = 180 degrees: image is upside down.
4 = 180 degrees, mirrored: image has been flipped back-to-front and is upside down.
5 = 90 degrees: image has been flipped back-to-front and is on its side.
6 = 90 degrees, mirrored: image is on its side.
7 = 270 degrees: image has been flipped back-to-front and is on its far side.
8 = 270 degrees, mirrored: image is on its far side.

I need the 6 orientation. Any suggestions what to do?

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