You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a front end using cropperjs that passes an image to the backend where we process it with Sharp.
We are rotating the image on our own so that the actual pixel dimensions determine whether the image is horizontal or vertical and then rotating it if needed to match a canvas nodes orientation. The actual exif orientation is not important and needs to be ignored.
Cropperjs has a flag to ignore it and it works great.
Then the image goes to our backend where Sharp processes it and if an image has exif orientation then it ends up being incorrect.
I see that withMetadata can edit exif orientation, but I don't see a way to remove it or ignore it. I tried using this anyways and setting it to 1 hoping that would be the same as nothing but it didn't work - nor did 8 for some reason. I did this as .withMetadata({orientation:8}) before any other operations. Seems like it should have done something so maybe I am doing it incorrectly? I think 1 could almost work as that seems like default/no rotation to me.
I also tried rotate(0) hoping it would take precedence over the exif orientation but it doesn't. If I know the exif is going to rotate it -90 then I can tell it to .rotate(-90) and it will correct it, but other then that on the backend I have not found a way to ignore the rotation like I can on the frontend.
Is it possible to ignore the exif rotation?
Thanks for any info!
The text was updated successfully, but these errors were encountered:
I have a front end using cropperjs that passes an image to the backend where we process it with Sharp.
We are rotating the image on our own so that the actual pixel dimensions determine whether the image is horizontal or vertical and then rotating it if needed to match a canvas nodes orientation. The actual exif orientation is not important and needs to be ignored.
Cropperjs has a flag to ignore it and it works great.
Then the image goes to our backend where Sharp processes it and if an image has exif orientation then it ends up being incorrect.
I see that withMetadata can edit exif orientation, but I don't see a way to remove it or ignore it. I tried using this anyways and setting it to 1 hoping that would be the same as nothing but it didn't work - nor did 8 for some reason. I did this as
.withMetadata({orientation:8})
before any other operations. Seems like it should have done something so maybe I am doing it incorrectly? I think 1 could almost work as that seems like default/no rotation to me.I also tried rotate(0) hoping it would take precedence over the exif orientation but it doesn't. If I know the exif is going to rotate it -90 then I can tell it to .rotate(-90) and it will correct it, but other then that on the backend I have not found a way to ignore the rotation like I can on the frontend.
Is it possible to ignore the exif rotation?
Thanks for any info!
The text was updated successfully, but these errors were encountered: