How to insert and save high resolution image to PDF #1004
Replies: 20 comments 3 replies
-
Try not to use pixmap for insertion, but directly use the file: |
Beta Was this translation helpful? Give feedback.
-
It still doesn't work My PNG image was originally 96dpi. It is effective to use pixmap to change it to 600dpi and then save the PNG with overlay. However, when it is saved as PDF, it becomes 72dpi
|
Beta Was this translation helpful? Give feedback.
-
Hm. Is your PNG transparent? If yes, then internally still a pixmap is generated to compute the separately required transparency mask image. |
Beta Was this translation helpful? Give feedback.
-
Meanwhile, I will look in the code to see if there is a way to enforce the dpi. |
Beta Was this translation helpful? Give feedback.
-
Oh, yes, my PNG has a transparent layer. So, how to save PNG with transparent layer as PDF and keep DPI unchanged? |
Beta Was this translation helpful? Give feedback.
-
I tried another way to insert the image, and the DPI was preserved, but the transparent layer was lost
So, is there any way to modify the DPI and keep the transparent layer at the same time? |
Beta Was this translation helpful? Give feedback.
-
I made a few code adjustments. What is your full environemnt (print(fitz.doc) output)? |
Beta Was this translation helpful? Give feedback.
-
ah, looks like Windows ... |
Beta Was this translation helpful? Give feedback.
-
Yes, it's Windows.
|
Beta Was this translation helpful? Give feedback.
-
I am still trying a few things. The current status is this:
The only option left is the following approach:
This would hopefully prevent / circumvent whatever is happening otherwise. |
Beta Was this translation helpful? Give feedback.
-
OK, I'll try later |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
It definitely happens inside MuPDF, not PyMuPDF. |
Beta Was this translation helpful? Give feedback.
-
OK, thank you so much. I will continue to pay attention to this issue. |
Beta Was this translation helpful? Give feedback.
-
Of course - thanks for your patience! |
Beta Was this translation helpful? Give feedback.
-
Hello, |
Beta Was this translation helpful? Give feedback.
-
What is your platform? |
Beta Was this translation helpful? Give feedback.
-
In the mean time, I tried the above given code. Thanks. |
Beta Was this translation helpful? Give feedback.
-
PyMuPDF-1.19.3-cp39-cp39-win_amd64.zip |
Beta Was this translation helpful? Give feedback.
-
Describe the bug (mandatory)
My PNG file is 600dpi, which is changed to 72 after storing as PDF.
How can I keep the original 600dpi unchanged when storing PDF?
To Reproduce (mandatory)
Your configuration (mandatory)
Python 3.8
PyMuPDF 1.18.9
Beta Was this translation helpful? Give feedback.
All reactions