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

Add support for LZWDecode compression #1271

Closed
Lucas-C opened this issue Oct 4, 2024 · 7 comments · Fixed by #1286
Closed

Add support for LZWDecode compression #1271

Lucas-C opened this issue Oct 4, 2024 · 7 comments · Fixed by #1286

Comments

@Lucas-C
Copy link
Member

Lucas-C commented Oct 4, 2024

Please explain your intent
Currently fpdf2 supports 4 compression methods for images:
https://github.com/py-pdf/fpdf2/blob/2.8.0/fpdf/image_parsing.py#L35

The PDF standard specification (cf. PDF32000_2008.pdf section 7.4 Filters) defines several other compression filters, including LZWDecode.

Recently, this filter was implemented by @MartinThoma in our companion library pypdf: py-pdf/pypdf#2883

Describe the solution you'd like
Support LZWDecode for images compression.

@opposss
Copy link

opposss commented Oct 7, 2024

Hi!

I'd love to work on this issue can you assign me?

@Lucas-C
Copy link
Member Author

Lucas-C commented Oct 7, 2024

Sure, done!

@Lucas-C
Copy link
Member Author

Lucas-C commented Oct 14, 2024

Hi @opposss

Have you been able to start working on this implementation?
Do you have any questions?

@opposss
Copy link

opposss commented Oct 14, 2024

Hi @Lucas-C

Almost done, I will send the PR for review soon.
Before that I would like to ask 2 questions:

  1. Do I understand correctly that I can completely use the code that was written by @MartinThoma ?

  2. Should I add logic to use the LZW filter in case of GIF images or other image formats?

@Lucas-C
Copy link
Member Author

Lucas-C commented Oct 14, 2024

Almost done, I will send the PR for review soon.

Great! 👍

  1. Do I understand correctly that I can completely use the code that was written by @MartinThoma ?

Yes!

  1. Should I add logic to use the LZW filter in case of GIF images or other image formats?

If you can find a mention that this is supported, in the PDF spec (PDF32000_2008.pdf), or that main PDF readers support it (Adobe Acrobat, Sumatra PDF, MuPDF, web browsers...), then yes!

opposss pushed a commit to opposss/fpdf2 that referenced this issue Oct 15, 2024
opposss pushed a commit to opposss/fpdf2 that referenced this issue Oct 17, 2024
opposss pushed a commit to opposss/fpdf2 that referenced this issue Oct 17, 2024
opposss pushed a commit to opposss/fpdf2 that referenced this issue Oct 21, 2024
opposss pushed a commit to opposss/fpdf2 that referenced this issue Oct 21, 2024
opposss pushed a commit to opposss/fpdf2 that referenced this issue Oct 21, 2024
opposss pushed a commit to opposss/fpdf2 that referenced this issue Oct 22, 2024
opposss pushed a commit to opposss/fpdf2 that referenced this issue Oct 22, 2024
@Lucas-C
Copy link
Member Author

Lucas-C commented Oct 23, 2024

This was implemented by @opposss in PR #1286

opposss pushed a commit to opposss/fpdf2 that referenced this issue Nov 16, 2024
opposss pushed a commit to opposss/fpdf2 that referenced this issue Nov 16, 2024
@Lucas-C
Copy link
Member Author

Lucas-C commented Dec 16, 2024

This feature has been included in the new release published today:
https://github.com/py-pdf/fpdf2/releases/tag/2.8.2

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

Successfully merging a pull request may close this issue.

2 participants