-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Add support to extract gray scale images #1460
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
Conversation
Codecov ReportBase: 94.31% // Head: 94.01% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #1460 +/- ##
==========================================
- Coverage 94.31% 94.01% -0.31%
==========================================
Files 28 30 +2
Lines 5171 5443 +272
Branches 980 1038 +58
==========================================
+ Hits 4877 5117 +240
- Misses 177 197 +20
- Partials 117 129 +12
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Very nice! Do you happen to have an example pdf where the new code would be applied? Or could you create one and upload it here? I would add it to the https://github.com/py-pdf/PyPDF2 + add a test |
Ok, I have uploaded a test file grayscale.pdf and added it to |
Hi @joeywang4 , I've just added the I want to avoid that the PyPDF2 repository becomes bigger and bigger due to example PDF files. This might have an impact on people who clone PyPDF2 / install from the repository. Hence adding the file via submodule. |
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.
The code looks good - thanks for adding the test!
Please just remove the resources/grayscale.pdf
and use SAMPLE_ROOT / "019-grayscale-image/grayscale-image.pdf"
instead :-)
@MartinThoma I have removed the test file and updated the path. Thanks for the suggestion! |
Very good work! 👍 If you want, I'll add you to the contributors list :-) |
New Features (ENH): - Add support to extract gray scale images (#1460) - Add 'threads' property to PdfWriter (#1458) - Add 'open_destination' property to PdfWriter (#1431) - Make PdfReader.get_object accept integer arguments (#1459) Bug Fixes (BUG): - Scale PDF annotations (#1479) Robustness (ROB): - Padding issue with AES encryption (#1469) - Accept empty object as null objects (#1477) Documentation (DOC): - Add module documentation the PaperSize class (#1447) Maintenance (MAINT): - Use 'page_number' instead of 'pagenum' (#1365) - Add List of pages to PageRangeSpec (#1456) Testing (TST): - Cleanup temporary files (#1454) - Mark test_tounicode_is_identity as external (#1449) - Use Ubuntu 20.04 for running CI test suite (#1452) [Full Changelog](2.11.2...2.12.0)
Currently, when gray scale images are extracted, they will be incorrectly transformed to RGB images. This PR fixed this issue by changing the palette and the mode when images are extracted.