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

png Exif orientation metadata ignored #1271

Open
vknightbd opened this issue Jul 27, 2022 · 3 comments
Open

png Exif orientation metadata ignored #1271

vknightbd opened this issue Jul 27, 2022 · 3 comments

Comments

@vknightbd
Copy link

This is a feature request rather than a bug. PNG with Exif orientation metadata (like from a phone or scanner that says the image is rotated 90 degrees) is ignored. So images are always inserted in its original orientation, and not according to Exif orientation metadata.

I'm mostly posting this in case someone searches for why PrawnPDF is rotating their PNG files but not their JPEGS after modifying the PNG in Mac Preview. Also for more info: https://www.daveperrett.com/articles/2012/07/28/exif-orientation-handling-is-a-ghetto/

@pointlessone
Copy link
Member

Thank you for the report.

Unlike JPEG, PNG is not a natively supported format in PDF. Prawn embeds JPEG images as is into the resulting PDF because JPEG is a natively supported format and all renderers should handle it properly. PNG, on the other hand, needs preprocessing. This is indeed a bug/missing feature of Prawn.

@volart
Copy link

volart commented Mar 2, 2024

Hey folks! I have an issue with JPEG images' orientation. The situation is next: I have a service which uses prawn for pdf generation(obviously) and I upload some photos made by phone in portrait orientation. However, it is in landscape orientation in a pdf. Sorry if my message is out of the current conversation scope. I would appreciate it if you confirm the issue or point me to where I'm wrong.

@gettalong
Copy link
Member

@volart It is probably the same problem. The JPEG is stored in landscape orientation and there is only some metadata telling viewers to correctly rotate it on display. In this case I would run a tool like jpegtran to correctly rotate the image before passing it to Prawn.

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

No branches or pull requests

4 participants