censor/Censor
1
37
Fork
You've already forked Censor
3

bug: applying redactions sometimes fails with only Gray, RGB, and CMYK colorspaces supported #155

Closed
opened 2026年03月18日 11:15:49 +01:00 by mahlzahn · 0 comments

Description

Traceback

src/document.py:173: in save
 mupdf_page.apply_redactions(
/usr/lib/python3.14/site-packages/pymupdf/__init__.py:10770: in apply_redactions
 rc = page._apply_redactions(text, images, graphics) # call MuPDF
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3.14/site-packages/pymupdf/__init__.py:9929: in _apply_redactions
 success = mupdf.pdf_redact_page(page.doc(), page, opts)
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
doc = <mupdf.PdfDocument; proxy of <Swig Object of type 'mupdf::PdfDocument *' at 0x7fea1fe92b70> >
page = <mupdf.PdfPage; proxy of <Swig Object of type 'mupdf::PdfPage *' at 0x7fea1fdc16b0> >, opts = (black_boxes=0 image_method=2 line_art=2 text=0)
 def pdf_redact_page(doc, page, opts):
 r"""Class-aware wrapper for `::pdf_redact_page()`."""
> return _mupdf.pdf_redact_page(doc, page, opts)
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E mupdf.FzErrorArgument: code=4: only Gray, RGB, and CMYK colorspaces supported

Examples for failing documents

How to reproduce with PyMuPDF

document = pymupdf.Document("tests/data/samples_artifex/foo0-ge-64k.pdf")
page = document[0]
page.add_redact_annot((140, 0, 150, 1))
page.apply_redactions()

Upstream issues

https://github.com/pymupdf/PyMuPDF/issues/4943

## Description ### Traceback ```py src/document.py:173: in save mupdf_page.apply_redactions( /usr/lib/python3.14/site-packages/pymupdf/__init__.py:10770: in apply_redactions rc = page._apply_redactions(text, images, graphics) # call MuPDF ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ /usr/lib/python3.14/site-packages/pymupdf/__init__.py:9929: in _apply_redactions success = mupdf.pdf_redact_page(page.doc(), page, opts) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ doc = <mupdf.PdfDocument; proxy of <Swig Object of type 'mupdf::PdfDocument *' at 0x7fea1fe92b70> > page = <mupdf.PdfPage; proxy of <Swig Object of type 'mupdf::PdfPage *' at 0x7fea1fdc16b0> >, opts = (black_boxes=0 image_method=2 line_art=2 text=0) def pdf_redact_page(doc, page, opts): r"""Class-aware wrapper for `::pdf_redact_page()`.""" > return _mupdf.pdf_redact_page(doc, page, opts) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E mupdf.FzErrorArgument: code=4: only Gray, RGB, and CMYK colorspaces supported ``` ### Examples for failing documents - [samples_artifex/foo0-ge-64k.pdf](https://github.com/ArtifexSoftware/tests/blob/master/pdf/foo0-ge-64k.pdf) ### How to reproduce with PyMuPDF ```py document = pymupdf.Document("tests/data/samples_artifex/foo0-ge-64k.pdf") page = document[0] page.add_redact_annot((140, 0, 150, 1)) page.apply_redactions() ``` ## Upstream issues https://github.com/pymupdf/PyMuPDF/issues/4943
mahlzahn changed title from (削除) bug: saving of some documents fails with "only Gray, RGB, and CMYK colorspaces supported" (削除ここまで) to bug: applying redactions sometimes fails with only Gray, RGB, and CMYK colorspaces supported 2026年03月18日 11:58:43 +01:00
mahlzahn 2026年03月18日 12:44:55 +01:00
Sign in to join this conversation.
No Branch/Tag specified
main
v0.7.3
v0.7.2
v0.7.1
v0.7.0
v0.6.0
v0.5.0
v0.4.0
v0.3.0
v0.2.0
v0.1.0
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
censor/Censor#155
Reference in a new issue
censor/Censor
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?