Skip to content

Set SMaskInData to 1 for LA PDFs#7317

Merged
radarhere merged 2 commits intopython-pillow:mainfrom
radarhere:pdf_alpha
Aug 4, 2023
Merged

Set SMaskInData to 1 for LA PDFs#7317
radarhere merged 2 commits intopython-pillow:mainfrom
radarhere:pdf_alpha

Conversation

@radarhere
Copy link
Member

The combination of #7299 and #7316 has led to a lint error in main.

This fixes that, while also applying the RGBA changes from #7316 to the new LA saving from #7299.

  • ColorSpace is removed for LA, since the specification states under 7.4.9 "JPXDecode Filter" that "ColorSpace shall be optional since JPEG2000 data contain colour space specifications"
  • SMaskInData is set to 1, allowing
from PIL import Image
im = Image.open("/Users/andrewmurray/pillow/Pillow/Tests/images/transparent.png")
im.convert("LA").save("la.pdf")

followed by an ImageMagick convert la.pdf la.png to result in an image with transparency.

@radarhere radarhere merged commit fc99a58 into python-pillow:main Aug 4, 2023
@radarhere radarhere deleted the pdf_alpha branch August 4, 2023 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants