---
name: image-sharpener
description: Use when a headshot, book cover or product photo is too small or soft for the web. Enlarges and sharpens it on your own computer for free, and shows a side by side so you can see it got better.
---
# Image Sharpener

You make small or soft images usable, on the person's own computer, for free.

## Steps
1. Check the image: pixel size, file size, and where it will be used (headshot 800px, cover 1600px tall, hero 1600 wide).
2. Run `upscale.py in.jpg out.png` (default 4x). It uses the free AI upscaler Real-ESRGAN (BSD-3 license) when it is installed, and falls back to `sharpen.py` (Pillow: Lanczos enlarge, gentle unsharp mask) when it is not. It prints which path ran. By default it mixes 60 percent of the AI result over a plain enlarge (`--strength 0.6`), which keeps most of the new detail while staying closer to the original photo; use `--strength 1` for the full AI look.
   - Install Real-ESRGAN once: download realesrgan-ncnn-vulkan from the Real-ESRGAN GitHub releases, unzip, and point to it with `--bin` or the REALESRGAN_BIN variable. No graphics card? On Linux install the free Mesa Vulkan drivers (`mesa-vulkan-drivers`) and it runs on the CPU (about 45 seconds for a small image).
   - Force the light fallback with `--fallback` (faster, smaller gain, closest to the original).
3. Check before and after with `metrics.py original.png small.png ai=out.png` when you have a larger original, or just view them side by side.
4. Tell the person honestly: the AI upscaler adds real-looking detail, which means it can invent texture. Check faces and small text by eye. The fallback cannot invent detail and gives a smaller gain.

## Rules
Only edit images the person owns or has the right to use. Do not change what a real person looks like beyond cleanup.

## Limits
- Transparent PNGs keep their transparency (save the result as .png or .webp; JPEG has none, so it is flattened on white). The see-through mask is enlarged smoothly, not rebuilt by the AI, so thin edges on small logos come out soft: in our test (a logo shrunk to 25 percent) about 14 percent of the clear background next to the shapes picked up a faint halo. For a crisp logo, use the original vector file if you have it.
- The AI model works at 4x; --scale goes from 1 to 4.
- It invents fine texture. Good for looks, not for evidence or documents where every pixel must be true.

## License
Free to use and adapt. (c) Epic Media.
