Claude-skills red-pen-remover

Red Pen Mark Remover

install
source · Clone the upstream repo
git clone https://github.com/lotosbin/claude-skills
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/lotosbin/claude-skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/.claude/skills/red-pen-remover" ~/.claude/skills/lotosbin-claude-skills-red-pen-remover && rm -rf "$T"
manifest: .claude/skills/red-pen-remover/Skill.md
source content

Red Pen Mark Remover

Removes red handwritten marks from scanned documents and images using color detection and inpainting algorithms.

Installation

pip install opencv-python pillow numpy

Usage

Python API

from red_pen_remover import remove_red_marks, batch_remove_red_marks, preview_masks

# Single image
remove_red_marks("document.jpg", "clean_document.jpg")

# Adjust sensitivity (0.0-1.0, lower = more aggressive)
remove_red_marks("document.jpg", "clean.jpg", sensitivity=0.2)

# Batch processing
batch_remove_red_marks("input_folder/", "output_folder/")

# Preview mask detection
preview_masks("document.jpg", "preview.jpg")

Command Line

python red_pen_remover.py input.jpg output.jpg [sensitivity]

Parameters

ParameterTypeDefaultDescription
input_pathstr-Path to input image
output_pathstr-Path to save output
sensitivityfloat0.3Color detection sensitivity (0.0-1.0)
radiusint3Inpainting radius
methodstr"telea"Inpainting method: "telea" or "ns"

Tips

  • High sensitivity (0.4-0.5): Better for bright, clear scans
  • Low sensitivity (0.1-0.2): Better for dark or noisy images
  • Use
    preview_masks()
    to tune sensitivity before processing
  • Works best on documents with clear contrast between text and marks

How It Works

  1. Color Detection: Converts image to HSV color space and identifies red pixels
  2. Mask Processing: Applies morphological operations to clean up the mask
  3. Inpainting: Uses OpenCV's inpainting algorithm to fill in removed regions