page.apply_redactions() breaks transparent images in pdf
Please provide all mandatory information!
Describe the bug (mandatory)
When using page.apply_redactions() on a pdf with an image that was originally transparent, the image background turns an odd black colour.
To Reproduce (mandatory)
doc = fitz.open(<path/to/pdf_with_transparent_img>) for page in doc: ... redaction = page.addRedactAnnot(new_area, fill=col, text=" ") ... page.apply_redactions()
Expected behavior (optional)
background for images should remain white (transparent)
Screenshots (optional)

Your configuration (mandatory)
- Python==3.8.2
- PyMuPDF==1.18.8
This a known problem. It can be circumvented by either
- removing the complete overlapping image,
page.apply_redations(images=fitz.PDF_REDACT_IMAGE_REMOVE), or - ignoring the image overlap
page.apply_redations(images=fitz.PDF_REDACT_IMAGE_NONE)
Issue resolved with circumvention?
@JorjMcKie I am also facing the same issue. are there any other alternatives other than the mentioned one?
alternatives other than the mentioned one?
No. You may want to consider covering the resp. image part with the redaction rectangle having a background color (e.g. white) instead.
Ok. will try that. is there any way to identify images in a PDF
any way to identify images in a PDF
What does that mean? There are more than one method for this: doc.get_page_images(), page.get_image_info(), page.get_text(), furthermore methods for locating image positions on the page, transformation matrices that made the original image fit into their bbox, etc., etc.