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

WIP: feat: redact vector graphics with less strict option #114

Draft
mahlzahn wants to merge 1 commit from mahlzahn/fix_redact_touched_graphics into main AGit
pull from: mahlzahn/fix_redact_touched_graphics
merge into: censor:main
censor:main

Edit: WIP for now, it should be optional, maybe in settings dialog or something else.

I implemented custom removal of graphics (vector drawings) using pypdf library when points are found within redaction rectangles.

This tries to remove drawings with any of the following properties from the page (on top of the redaction from PyMuPDF):

  • the drawing is fully covered by a redaction
  • any rectangle of the graphic is fully covered by a redaction
  • any curve, line, or quadruple has a point covered by a redaction
  • if the drawing has no item (curve, line, etc.) and intersects with a redaction

It by decision keeps a drawing even if its rectangle(s) have some intersection with redaction rectangles.

Only after this implementation, I understood that the original issue was that pymupdf.PDF_REDACT_LINE_ART_REMOVE_IF_TOUCHED was not applied because of a documentation issue. It is now applied if the custom removal fails.

Related: #5, !115

Edit: WIP for now, it should be optional, maybe in settings dialog or something else. I implemented custom removal of graphics (vector drawings) using pypdf library when points are found within redaction rectangles. This tries to remove drawings with any of the following properties from the page (on top of the redaction from PyMuPDF): - the drawing is fully covered by a redaction - any rectangle of the graphic is fully covered by a redaction - any curve, line, or quadruple has a point covered by a redaction - if the drawing has no item (curve, line, etc.) and intersects with a redaction It by decision keeps a drawing even if its rectangle(s) have some intersection with redaction rectangles. Only after this implementation, I understood that the original issue was that `pymupdf.PDF_REDACT_LINE_ART_REMOVE_IF_TOUCHED` was not applied because of a [documentation issue](https://github.com/pymupdf/PyMuPDF/issues/4924). It is now applied if the custom removal fails. Related: #5, !115

Warning

The build job for 4742741a3fe477c349add6879ac3f048fd7fafb3 finished with status failed.

> **Warning** > The [build job](https://gitlab.gnome.org/mahlzahn/censor-ci/-/jobs/6245449) for 4742741a3fe477c349add6879ac3f048fd7fafb3 finished with status **failed**.
mahlzahn force-pushed mahlzahn/fix_redact_touched_graphics from 4742741a3f
Some checks failed
/ build-start (pull_request_target) Successful in 13s
/ merge-conditions (pull_request) Failing after 10s
/ checks (pull_request) Failing after 1m5s
to 1f65f4fc2e
Some checks failed
/ build-start (pull_request_target) Successful in 13s
/ checks (pull_request) Successful in 1m10s
/ release-prepare (pull_request_target) Has been skipped
/ merge-conditions (pull_request) Failing after 17s
2026年03月06日 15:23:27 +01:00
Compare
mahlzahn added this to the v0.5.0 milestone 2026年03月06日 15:23:45 +01:00
censor-bot approved these changes 2026年03月06日 15:24:12 +01:00
Dismissed

Note

The build job for 1f65f4fc2e finished with status success. Install and run the x86_64 test build with:

curl https://gitlab.gnome.org/mahlzahn/censor-ci/-/jobs/6246303/artifacts/raw/censor-dev.flatpak -o censor-dev.flatpak
flatpak install --user censor-dev.flatpak
flatpak run --user page.codeberg.censor.Censor.Devel
> **Note** > The [build job](https://gitlab.gnome.org/mahlzahn/censor-ci/-/jobs/6246303) for 1f65f4fc2e3accdef3be5d078b9db9106ea62684 finished with status **success**. Install and run the x86_64 test build with: > > curl https://gitlab.gnome.org/mahlzahn/censor-ci/-/jobs/6246303/artifacts/raw/censor-dev.flatpak -o censor-dev.flatpak > flatpak install --user censor-dev.flatpak > flatpak run --user page.codeberg.censor.Censor.Devel
mahlzahn changed title from (削除) fix: redact vector graphics (削除ここまで) to feat: redact vector graphics with less strict option 2026年03月06日 16:03:31 +01:00
mahlzahn modified the milestone from v0.5.0 to v0.6.0 2026年03月06日 16:03:57 +01:00
mahlzahn changed title from (削除) feat: redact vector graphics with less strict option (削除ここまで) to WIP: feat: redact vector graphics with less strict option 2026年03月06日 17:10:36 +01:00
mahlzahn modified the milestone from v0.6.0 to v0.7.0 2026年03月17日 20:31:01 +01:00
mahlzahn removed this from the v0.7.0 milestone 2026年03月24日 16:37:27 +01:00

Note

The build job for 1f65f4fc2e finished with status success. Install and run the x86_64 test build with:

curl https://gitlab.gnome.org/mahlzahn/censor-ci/-/jobs/6756875/artifacts/raw/censor-dev.flatpak -o censor-dev.flatpak
flatpak install --user censor-dev.flatpak
flatpak run --user page.codeberg.censor.Censor.Devel
> **Note** > The [build job](https://gitlab.gnome.org/mahlzahn/censor-ci/-/jobs/6756875) for 1f65f4fc2e3accdef3be5d078b9db9106ea62684 finished with status **success**. Install and run the x86_64 test build with: > > curl https://gitlab.gnome.org/mahlzahn/censor-ci/-/jobs/6756875/artifacts/raw/censor-dev.flatpak -o censor-dev.flatpak > flatpak install --user censor-dev.flatpak > flatpak run --user page.codeberg.censor.Censor.Devel
Some checks failed
/ build-start (pull_request_target) Successful in 13s
Required
Details
/ checks (pull_request) Successful in 1m10s
Required
Details
/ release-prepare (pull_request_target) Has been skipped
/ merge-conditions (pull_request) Failing after 17s
Required
Details
This pull request has changes conflicting with the target branch.
  • .forgejo/workflows/checks.yml
  • .forgejo/workflows/dependencies.yml
  • page.codeberg.censor.Censor.json
  • po/censor.pot
  • src/about_dialog.py
  • src/document.py
  • src/meson.build
  • src/rectangle.py
  • tests/document_test.py
  • tests/rectangle_test.py
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin +refs/pull/114/head:mahlzahn/fix_redact_touched_graphics
git switch mahlzahn/fix_redact_touched_graphics
Sign in to join this conversation.
No reviewers
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
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!114
Reference in a new issue
censor/Censor
No description provided.
Delete branch "mahlzahn/fix_redact_touched_graphics"

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?