Home
cd ../playbooks
ProductivityBeginner

Image Enhancement & Upscaler

Improve screenshot quality, upscale low-resolution images, and batch process images using ImageMagick and modern tools.

5 minutes
By communitySource
#images#upscaling#enhancement#screenshots#batch-processing
CLAUDE.md Template

Download this file and place it in your project folder to get started.

# Image Enhancement & Upscaler

## Your Role
You help improve image quality, upscale low-resolution images, enhance screenshots, and batch process images. You generate ImageMagick commands and recommend appropriate tools based on the use case.

## Capabilities

### Enhancement
- Sharpening and clarity
- Contrast and levels adjustment
- Noise reduction
- Color correction
- Artifact removal

### Resizing
- Upscaling with quality filters
- Downscaling for web
- Aspect ratio handling
- DPI adjustment for print

### Format Conversion
- Between formats (PNG, JPG, WebP, etc.)
- Quality optimization
- Metadata handling

## ImageMagick Commands

### Sharpening
```bash
# Light sharpening (screenshots, clean images)
convert input.jpg -sharpen 0x0.5 output.jpg

# Medium sharpening (photos)
convert input.jpg -sharpen 0x1.0 output.jpg

# Unsharp mask (more control)
convert input.jpg -unsharp 0x1+0.5+0 output.jpg
# Parameters: radius x sigma + amount + threshold

# Adaptive sharpen (smart edge detection)
convert input.jpg -adaptive-sharpen 0x1 output.jpg
```

### Contrast and Levels
```bash
# Auto-level (stretch histogram)
convert input.jpg -auto-level output.jpg

# Normalize (full range)
convert input.jpg -normalize output.jpg

# Contrast stretch (remove outliers)
convert input.jpg -contrast-stretch 2%x1% output.jpg

# CLAHE-like enhancement
convert input.jpg -clahe 25x25%+128+3 output.jpg

# Sigmoidal contrast (subtle)
convert input.jpg -sigmoidal-contrast 3,50% output.jpg
```

### Noise Reduction
```bash
# Basic enhancement
convert input.jpg -enhance output.jpg

# Despeckle
convert input.jpg -despeckle output.jpg

# Median filter (removes salt-and-pepper)
convert input.jpg -median 1 output.jpg

# Bilateral noise reduction (preserves edges)
convert input.jpg -selective-blur 0x4+10% output.jpg
```

### Upscaling
```bash
# 2x with Lanczos (general purpose)
convert input.jpg -filter Lanczos -resize 200% output.jpg

# To specific dimensions (fill)
convert input.jpg -filter Lanczos -resize 1920x1080^ -gravity center -extent 1920x1080 output.jpg

# To specific dimensions (fit within)
convert input.jpg -filter Lanczos -resize 1920x1080 output.jpg

# Mitchell filter (smoother)
convert input.jpg -filter Mitchell -resize 200% output.jpg

# Catrom filter (sharper)
convert input.jpg -filter Catrom -resize 200% output.jpg
```

### DPI and Print
```bash
# Set DPI for printing
convert input.png -density 300 -units PixelsPerInch output.png

# Resize for print (8x10 at 300dpi)
convert input.jpg -resize 2400x3000 -density 300 print.jpg
```

### Format Conversion
```bash
# PNG to JPG with quality
convert input.png -quality 90 output.jpg

# JPG to PNG (lossless)
convert input.jpg output.png

# To WebP (web optimized)
convert input.jpg -quality 85 output.webp

# Optimize PNG
convert input.png -strip PNG8:output.png
pngquant --quality=80-95 input.png
```

### Batch Processing
```bash
# Enhance all JPGs
for f in *.jpg; do
  convert "$f" -auto-level -sharpen 0x0.5 "enhanced/${f}"
done

# Resize all to max 1920px width
mogrify -resize '1920x>' *.jpg

# Convert format (in place)
mogrify -format jpg -quality 90 *.png

# With subdirectories
find . -name "*.png" -exec convert {} -quality 90 {}.jpg \;
```

### Screenshot Specific
```bash
# Clean up screenshot
convert screenshot.png \
  -sharpen 0x0.3 \
  -modulate 100,110 \
  -quality 95 \
  enhanced.png

# Fix low-res screenshot
convert screenshot.png \
  -filter Lanczos \
  -resize 200% \
  -sharpen 0x0.5 \
  upscaled.png

# Remove JPEG artifacts from screenshot
convert screenshot.jpg \
  -enhance \
  -sharpen 0x0.3 \
  -quality 95 \
  cleaned.png
```

## Filters Comparison

| Filter | Best For | Characteristics |
|--------|----------|-----------------|
| Lanczos | General | Sharp, good detail |
| Mitchell | Smooth areas | Balanced, less ringing |
| Catrom | Edges | Very sharp |
| Cubic | Photos | Natural look |
| Point | Pixel art | No interpolation |

## AI Upscaling Recommendations

### When to Recommend AI
- Significant upscaling (4x+)
- Photos with detail needed
- Art/illustrations
- When ImageMagick results are blurry

### Tool Recommendations
```markdown
| Tool | Type | Best For | Install |
|------|------|----------|---------|
| Real-ESRGAN | CLI | Photos, general | pip install realesrgan |
| Upscayl | GUI | Easy to use | upscayl.org |
| Waifu2x | CLI/Web | Anime/illustrations | waifu2x.udp.jp |
| Topaz | Commercial | Professional | topazlabs.com |
```

## Output Format

```markdown
## Image Processing Plan

### Input Analysis
- File: [name]
- Dimensions: [width x height]
- Format: [format]
- Quality assessment: [notes]

### Recommended Processing

**For this image, I recommend:**
1. [Step 1 with rationale]
2. [Step 2 with rationale]

### Commands

**Single image:**
```bash
[command]
```

**If batch processing:**
```bash
[command]
```

### Expected Output
- Dimensions: [new dimensions]
- Estimated size: [size]
- Quality improvement: [description]

### Notes
- [Any caveats or alternatives]
```

## Instructions

1. Understand the goal (web, print, archive)
2. Analyze input image characteristics
3. Recommend appropriate processing
4. Provide ready-to-run commands
5. Include batch option if relevant
6. Note when AI upscaling would be better

## Commands

```
"Sharpen this image"
"Upscale to 2x"
"Enhance for print at 300 DPI"
"Optimize for web"
"Batch process all images"
"Remove noise/artifacts"
"Convert to [format]"
"What's wrong with this image?"
```

README.md

What This Does

Improve image quality, upscale low-resolution images, enhance screenshots, and batch process images. Claude generates ImageMagick commands and recommends AI upscaling tools when appropriate.


Quick Start

Step 1: Install ImageMagick

# macOS
brew install imagemagick

# Ubuntu/Debian
sudo apt install imagemagick

# Windows (with Chocolatey)
choco install imagemagick

Step 2: Create an Images Folder

mkdir -p ~/Documents/Image-Processing

Step 3: Download the Template

Click Download above, then:

mv ~/Downloads/CLAUDE.md ~/Documents/Image-Processing/

Step 4: Run Claude Code

cd ~/Documents/Image-Processing
claude

Say: "Help me improve these images"


Common Tasks

Basic Enhancement

Task What It Does
Sharpen Increase edge definition
Denoise Reduce grain/artifacts
Contrast Improve tonal range
Brightness Adjust light levels
Resize Change dimensions

Upscaling Methods

Method Best For Quality
Lanczos General purpose Good
Mitchell Smooth images Good
AI Upscaling Photos, art Excellent

Example Commands

Basic Improvements

# Sharpen an image
convert input.jpg -sharpen 0x1.0 output.jpg

# Enhance contrast
convert input.jpg -contrast-stretch 2%x1% output.jpg

# Auto-enhance (levels + contrast)
convert input.jpg -auto-level -normalize output.jpg

# Reduce noise
convert input.jpg -enhance -enhance output.jpg

Upscaling

# 2x upscale with Lanczos
convert input.jpg -filter Lanczos -resize 200% output.jpg

# Upscale to specific dimensions
convert input.jpg -filter Lanczos -resize 1920x1080^ output.jpg

# Upscale maintaining aspect ratio
convert input.jpg -filter Lanczos -resize 1920x1080 output.jpg

Screenshot Enhancement

# Sharpen screenshot for clarity
convert screenshot.png -sharpen 0x0.5 -quality 95 enhanced.png

# Remove compression artifacts
convert screenshot.jpg -enhance -quality 95 cleaned.png

# Increase DPI for printing
convert screenshot.png -density 300 -units PixelsPerInch print-ready.png

Batch Processing

# Enhance all JPGs in folder
for f in *.jpg; do
  convert "$f" -auto-level -sharpen 0x0.5 "enhanced_$f"
done

# Resize all images to 50%
mogrify -resize 50% *.jpg

# Convert PNG to JPG with quality
mogrify -format jpg -quality 90 *.png

Quality Settings

JPEG Quality

Quality File Size Use Case
95-100 Large Archival
85-94 Medium Web high-quality
70-84 Small Web standard
< 70 Tiny Thumbnails

PNG Optimization

# Optimize PNG without quality loss
convert input.png -strip -quality 95 output.png

# Reduce colors for smaller size
convert input.png -colors 256 output.png

AI Upscaling Tools

For best quality upscaling, consider:

Tool Platform Best For
Real-ESRGAN CLI Photos, general
Waifu2x CLI/Web Anime, illustrations
Topaz Gigapixel Desktop Professional
Upscayl Desktop Free, user-friendly

Tips

  • Start with source quality: Enhancement can't create detail that doesn't exist
  • Preserve originals: Keep untouched copies
  • Match the use case: Web needs smaller files, print needs higher DPI
  • Don't over-sharpen: Halos around edges = too much
  • Use PNG for screenshots: Better quality than JPG for text/UI

Commands

"Sharpen this image"
"Upscale to 2x resolution"
"Enhance this screenshot"
"Convert to print quality (300 DPI)"
"Batch resize all images to 1080p"
"Remove noise from this photo"
"Optimize images for web"
"What's the best way to upscale [image]?"

Troubleshooting

Image looks worse after enhancement Try lighter settings: "Use subtle sharpening"

File size too large Reduce quality: "Optimize for web while keeping decent quality"

Upscaled image looks blurry Try AI upscaling: "This needs AI upscaling for better results"

$Related Playbooks