-
Notifications
You must be signed in to change notification settings - Fork 634
Closed
Labels
upstream bugbug outside this packagebug outside this package
Description
Description
Image in a PDF file changes color after applying redactions.
To Reproduce
Execute the following python script to reproduce the issue. The script uses this pdf file image_issue.pdf .
import os
import fitz
script_path = os.path.abspath(__file__)
script_folder = os.path.dirname(script_path)
doc = fitz.open(os.path.join(script_folder, 'image_issue.pdf'))
page = doc.load_page(0)
rx=135.123
ry=123.56878
rw=69.8409
rh=9.46397
x0 = rx
y0 = ry
x1 = rx + rw
y1 = ry + rh
rect = fitz.Rect(x0, y0, x1, y1)
font = fitz.Font("Helvetica")
fill_color=(0,0,0)
page.add_redact_annot(
quad=rect,
#text="null",
fontname=font.name,
fontsize=12,
align=fitz.TEXT_ALIGN_CENTER,
fill=fill_color,
text_color=(1,1,1),
)
page.apply_redactions()
doc.save(os.path.join(script_folder, 'image_issue_redacted.pdf'))
Note that I am using the default images=2 (blank out overlapping image parts) when calling apply_redactions(). Using images= 0 (ignore) or images=1(remove complete overlapping image) are not desirable for my use case.
Expected behavior
The color of the image in the pdf file should not change after applying redactions.
Screenshots
Here's a screenshot of the problem.
Your configuration
- Operating system Ubuntu 22.04.1 LTS
- Python version 3.8.14
- PyMuPDF version 1.20.2
Metadata
Metadata
Assignees
Labels
upstream bugbug outside this packagebug outside this package