Unlock Flawless Images: AI-Powered Watermark Removal Workflow
1. Workflow Overview

This workflow is designed for automated or semi-automated removal of watermarks and logos from images. It supports two different detection modules (Florence2 and GroundingDINO + SAM) and allows manual mask adjustments. The final output is a cleaned image with a comparison view.
2. Core Models
Model | Function | Source |
|---|---|---|
Florence2 | Microsoft's OCR+region detection model, excels at text/logo detection |
|
GroundingDINO | Object detection for watermark/logo localization |
|
SAM (Segment Anything) | Segmentation model for precise masks |
|
Stable Diffusion (Inpainting) | Image inpainting to fill removed areas | e.g., |
3. Key Nodes
(1) Image Loading & Preprocessing
LoadImage: Load input image (e.g.,watermark-image-1.png).ImageScaleByAspectRatio: Resize image (e.g.,1024x1024) while maintaining aspect ratio.
(2) Watermark Detection Modules
Module 1: Florence2 (OCR+Region Detection)
Florence2ModelLoader: Load Florence2 model (requires HuggingFace token).Florence2Run: Run detection to output masks and text data.
Module 2: GroundingDINO + SAM
GroundingDinoSAMSegment: Combines DINO (detection) and SAM (segmentation) for mask generation.GrowMaskWithBlur: Expands mask edges for natural blending.
(3) Image Inpainting
InpaintCrop: Crop the region to be repaired.KSampler: Use Stable Diffusion (e.g.,realisticVisionV60B1) for inpainting.InpaintStitch: Stitch the inpainted area back to the original image.
(4) Output & Comparison
SaveImage: Save the final result.Image Comparer: Side-by-side comparison of before/after results.
4. Workflow Structure
Group 1: Input & Preprocessing
Input: Image file (e.g., PNG/JPG).
Output: Resized image.
Group 2: Watermark Detection (Dual Modules)
Input: Resized image.
Output: Mask (for watermark/logo).
Group 3: Inpainting & Stitching
Input: Mask + original image.
Output: Repaired image.
Group 4: Result Comparison
Input: Original vs. repaired image.
Output: Comparison slider view.
5. Inputs & Outputs
Input Parameters
Image file (e.g.,
watermark-image-1.png).Model choice (Florence2 or GroundingDINO+SAM).
Inpainting settings (e.g., steps
20, CFG1).
Output
Cleaned image (watermark removed).
Comparison view (optional).
6. Notes
Installation Dependencies
Florence2: Requires HuggingFace account and API token.
pip install transformersGroundingDINO + SAM:
Install from GitHub:
git clone https://github.com/IDEA-Research/GroundingDINO git clone https://github.com/facebookresearch/segment-anythingDownload model weights (e.g.,
sam_vit_h_4b8939.pth).
ComfyUI Plugins:
Install via ComfyUI Manager:
rgthree Nodes(for context management).LayerUtility(image scaling).
Troubleshooting
CUDA Out of Memory: Reduce resolution or launch ComfyUI with
--medvram.Model Load Failures: Verify weight file paths.
Inaccurate Masks: Manually adjust
GrowMaskWithBlur(e.g.,expand pixels=5).
Optimization Tips
Use RTX 3090/4090 or better GPU for optimal speed.
For 4K images, downsample to
1024x1024first.
7. Summary
This workflow is ideal for batch watermark removal, combining auto-detection with manual control. Florence2 works best for text, while GroundingDINO+SAM handles graphic logos. Output quality depends on the SD model (e.g., realisticVision for photos, revAnimated for anime).
Tip: Test on small images first and fine-tune mask settings!