PDFs with zero-width lines render faint/gray instead of black when converting to image #4532
-
When converting engineering drawing PDFs to images using PyMuPDF (fitz), pages containing lines with zero or very small width render these lines as faint gray instead of solid black, making them nearly invisible. This issue affects drawings printed from AutoCAD to PDF, where the line width in the PDF is set to zero (hairline). Other PDFs with thicker line widths render correctly (lines appear solid black as expected). This makes technical drawings hard to read and affects downstream processing, as the intent is to preserve the appearance of black lines/curves on a white background. Technical details:
Please advise if there is a way to force hairlines to render solid black in PyMuPDF with increased line width, or if this is a MuPDF limitation. Any workaround, parameter, or planned fix would be much appreciated. Thank you for your work on PyMuPDF! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Can you please try to set the anti-aliasing level before making the Pixmap: |
Beta Was this translation helpful? Give feedback.
Can you please try to set the anti-aliasing level before making the Pixmap:
pymupdf.TOOLS.set_aa_level(0)
.