-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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 is handled incorrectly #3795
Comments
I am facing same issue with addImage function, it does not respect exif orientation. Bellow you can find my suboptimal solution if anyone needs it before this gets addressed. Uses canvas to draw image first, canvas rendering will display image correctly then grabbing data and passing it to addImage fn.
|
I also think something is wrong with how jspdf handles the rotation. Lets say i have an image as Base64 with the following dimensions: width: 100 After creating an image
Then the dimensions seem correctly rotated because
Then i add an page to jspdf with
and add the correct image like this
On my pdf then the page dimensions are correct (height is bigger then width), but the image is not rotated even tough it most probably was already rotated when creating the image . The workaround with drawing on Canvas and giving this image to jspdf works. |
@HackbrettXXX if you point me to the approximate position of where the code for this functionality is located, I am happy to create a PR (when I find the time lol) |
@HackbrettXXX maybe we should get that over the line first then? Seems like a major rework to add typescript |
I wouldn't worry too much about the TypeScript branch for now. Going to take an approach which involves a bunch of smart automation, so feel free to get this merged when it's ready. |
jspdf handles exif orientation and correctly flips width and height. However, it does not actually rotate the image. Instead it just stretches the unrotated image into its rotated shape.
This issue has been rised twice already but it seems that nobody realized that the image is not correctly rotated
In both issues you can actually see, that albeit the image dimension was rotated, the content was not.
I encountered the issue when using svg2pdf.js. You can also see another example in the issue I raised: yWorks/svg2pdf.js#315. The orientation is correct, the content is still unrotated and just stretched
The text was updated successfully, but these errors were encountered: