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

Issue #1271 added LZWDecode compression #1286

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Issue #1271 padding rework and CHANGELOG
  • Loading branch information
opposss committed Oct 22, 2024
commit 88e75c5f286e8cc2e1311a1da0c2eeb16b24c44e
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ in order to get warned about deprecated features used in your code.
This can also be enabled programmatically with `warnings.simplefilter('default', DeprecationWarning)`.

## [2.8.2] - Not released yet
### Added
* support for LZWDecode compression [issue #1271](https://github.com/py-pdf/fpdf2/issues/1271)
### Fixed
* `FPDF.set_text_shaping(False)` was broken since version 2.7.8 and is now working properly - [issue #1287](https://github.com/py-pdf/fpdf2/issues/1287)

## [2.8.1] - 2024-10-04
### Added
Expand Down
10 changes: 5 additions & 5 deletions fpdf/image_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,12 +550,12 @@ def _to_lzwdata(img, remove_slice=None, select_slice=None):
else:
channels_count = len(data) // (img.size[0] * img.size[1])
row_size = img.size[0] * channels_count
data_with_padding = bytearray()
for i in range(0, len(data), row_size):
data_with_padding.extend(b"\0")
data_with_padding.extend(data[i : i + row_size])
data = data_with_padding

data_with_padding = bytearray()
for i in range(0, len(data), row_size):
data_with_padding.extend(b"\0")
data_with_padding.extend(data[i : i + row_size])
data = data_with_padding
# Start compression

# The encoder shall begin by issuing a clear-table code:
Expand Down