-
Notifications
You must be signed in to change notification settings - Fork 566
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
Topmost pixels of Big PNG object gets black using insert_image() function #4128
Comments
Apologies for taking time to look at this. The above link https://we.tl/t-1VdSrVImwP has expired - could you create a new link? |
Hello Julian, Sure here is an updated Link. It will expire in 7 days again :( I did some further testing and i got a work around in reducing the DPI to exactly 300DPI or below, I did not get this issue since. But i prefer to not alter the images and reduce quality if i dont have to |
Hi, just the morning after i said we did not get this issue since scaling down to 300dpi i got this issue again. It is here the last image on this gangsheet This is my code snippet on how i use the insert_image() image = Image.open(path).convert("RGBA") img_bytes = io.BytesIO() page.insert_image(placings_rect, stream=img_bytes.getvalue(), rotate=rotate) |
Hello, Here is the new Wetransfer link, the one above should expire today https://we.tl/t-nrGpQYSu11 |
Thanks for the third link, actually i downloaded from the second link, so i now have the file. I can reproduce the problem, but i don't yet understand what's going wrong. |
Hi Julian, good to know you are able to reproduce the issue! If i can be of any help, sadly i am new to programming so i probably cannot help with this. But maybe more files where i find this exact issue might help, what do you think? |
Description of the bug
When using PyMuPDF's insert_image function to insert a transparent PNG into a PDF, certain areas of the image (notably the topmost pixels) appear as solid black in the generated PDF. This issue is most noticeable in large PNG images (~300 DPI, dimensions such as 56 cm x 100 cm)
I tried the insert_image() function with the Image parameter as a File, Pixmap and stream. All had the same result
Here the resulting PDF file:
23511_1_No.pdf
Screenshot of the PNG wihtout the issue
Screenshot of the PDF with the issue
The PNG was sadly to big for uploading so i here is a wetransfer link:
https://we.tl/t-1VdSrVImwP
How to reproduce the bug
use insert_image() function with a large PNG with transparency and semi transparency
PyMuPDF version
1.24.12
Operating system
Windows
Python version
3.12
The text was updated successfully, but these errors were encountered: