Skip to content
This repository has been archived by the owner on Feb 16, 2023. It is now read-only.

Remove alpha layer from PNG files for img2pdf #1663

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

muellermartin
Copy link

If a PNG file with an alpha layer is loaded in paperless-ng, the upload fails with an UnsupportedImageFormatError() although PNG files are generally supported. The error comes from OCRmyPDF (line 76 in src/ocrmypdf/_pipeline.py) which in turn tries to fulfill the requirements for img2pdf.

img2pdf states that it is meant for lossless conversion and thus does not want alter the input images (e.g. by removing the alpha layer) for conversion.

This PR checks if input images have an alpha layer and removes it by blending it with a white background. This enables support for images with alpha layers and fixes issue #1254.

@qcasey
Copy link

qcasey commented Feb 22, 2022

Hi @muellermartin, this repo appears to be abandoned. I'd encourage you to open your PR in the Paperless revival project, paperless-ngx.

@muellermartin
Copy link
Author

@qcasey Oh, thanks for the hint. I will submit the PR there again.

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

Successfully merging this pull request may close these issues.

None yet

2 participants