Skip to content

Commit

Permalink
Pad PDF palette to 256 entries when saving
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Nov 15, 2023
1 parent da0b826 commit 55d8283
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/PIL/PdfImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def _write_image(im, filename, existing_pdf, image_refs):
elif im.mode == "P":
filter = "ASCIIHexDecode"
palette = im.getpalette()
palette += (768 - len(palette)) * [0]
dict_obj["ColorSpace"] = [
PdfParser.PdfName("Indexed"),
PdfParser.PdfName("DeviceRGB"),
Expand Down

0 comments on commit 55d8283

Please sign in to comment.