Highlights of GroupDocs.Redaction for Python via .NET

Protect Images in DOCX Documents Using Overlays with Python

Keep personal and business visuals safe in DOCX files using Python. Our redaction tools make document security easy.

Keep Data Safe in Docx Files

GroupDocs.Redaction for Python via .NET makes it easy for Python via .NET applications to protect documents. Redact sensitive data in just a few steps.

  1. Create a Redactor instance and specify the path to the Docx file.
  2. Set up redaction preferences to fit your task.
  3. Choose the image part you want to cover and define the overlay color.
  4. Run the process and save the redacted file.
import groupdocs.redaction as gr
import groupdocs.redaction.redactions as grr
import groupdocs.pydrawing as grd

# Hide sensitive parts of images in DOCX

# Define overlay size and color
replacement_size = grd.Size(100, 100)
color = grd.Color.from_argb(255, 220, 20, 60)
replacement_options = grr.RegionReplacementOptions(color, replacement_size)

# Specify the area for redaction
replacement_point = grd.Point(200, 200)
redaction = grr.ImageAreaRedaction(replacement_point, replacement_options)
        
# Load file using Redactor
with gr.Redactor("input.docx") as redactor:

    # Apply overlay and save your document
    result = redactor.apply(redaction)
    redactor.save()
pip install groupdocs-redaction-net
click to copy
copied
More examples Documentation

Hide Content in Documents

With GroupDocs.Redaction for Python via .NET, you can easily hide or remove sensitive information from various document types. Keep files secure and shareable.

Effective Redaction Features

Search & Edit Text

Locate sensitive words and replace them to protect your data.

Cover Images

Apply overlays to full images or selected parts to protect visual data.

Clean Hidden Metadata

Remove or update metadata to prevent accidental data sharing.

Hide Image Data Using Overlays

This example shows how to protect sensitive image areas in documents with overlays.

Python

import groupdocs.redaction as gr
import groupdocs.redaction.options as gro
import groupdocs.redaction.redactions as grr
import groupdocs.pydrawing as grd

# Set overlay settings: color, size, position
replacement_size = grd.Size(300, 30)
color = grd.Color.from_argb(255, 220, 20, 60)
replacement_options = grr.RegionReplacementOptions(color, replacement_size)
replacement_point = grd.Point(20, 125)
redaction = grr.ImageAreaRedaction(replacement_point, replacement_options)

# Pick an area to redact on page one
redaction.filters = [
    grr.PageRangeFilter(grr.PageSeekOrigin.BEGIN, 0, 1),
    grr.PageAreaFilter(grd.Point(0, 300), grd.Size(600, 600))
]

# Load the file you want to redact
with gr.Redactor("source.docx") as redactor:

    # Apply overlay to cover the image
    result = redactor.apply(redaction)

    # Save the redacted file
    save_options = gro.SaveOptions()
    save_options.add_suffix = True
    save_options.rasterize_to_pdf = False
    result_path = redactor.save(save_options)
pip install groupdocs-redaction-net
click to copy
copied
More examples Documentation

About GroupDocs.Redaction for Python via .NET

GroupDocs.Redaction for Python via .NET gives Python developers the ability to hide or delete content in DOCX files. Protect text, images, and metadata across multiple document formats.
Learn more
About illustration

Ready to get started?

Download GroupDocs.Redaction for free or get a trial license for full access!

Useful resources

Explore documentation, code samples, and community support to enhance your experience.

Hide Sensitive Data in DOCX Files with Python

Use Python to cover or erase private data in DOCX files. The right tool for keeping confidential documents secure.

Temporary license tips

1
Sign up with your work email.
Free mail services are not allowed.
2
Use Get a temporary license button on the second step.
 English