-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Added PDF read for macOS #1969
Added PDF read for macOS #1969
Conversation
raise SyntaxError("PDF file could not be converted") | ||
|
||
im = Image.open(filepath) | ||
im.load() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, ok. Because we are deleting source file.
In my opinion, this is not PDF image files reader, Instead this is PDF converter. Of course, it can be very useful, but I don't think that Pillow is the best place for this code. In my opinion it is better to create separate package. |
I'd probably prefer a more generic approach to reading PDFs (i.e. cross plat, not macOS only) |
@aclark4life I'm for adding PDF reading, but not with such approach. |
Sure. Feel free to close. The thinking was just that perhaps adding functionality for one platform was better than no functionality. |
Thanks |
OS X has a command line tool called 'sips' installed by default. It is able to convert the first page of a PDF to an image. So this PR adds PDF read functionality for OS X by converting a PDF into a temporary file and then loading the file as a PngImageFile. Not quite sure about this approach, so I thought I'd put it up here for feedback before adding anything like documentation or tests.
This could be considered a partial implementation of #471