Blur & Pixelate Image: how it works and how to build one
Blur or pixelate faces, plates and private details. This guide explains what happens behind the button and shows the code, so you can build your own.
What it does
Drag boxes over the parts you want to hide (faces, number plates, addresses, card numbers) and blur, pixelate or black them out. Or blur the whole image for a background. Processed in your browser.
When to use it
- Hiding faces and number plates
- Redacting card numbers and addresses in screenshots
- Privacy before posting online
How to use it
- Open an image.
- Drag boxes over what to hide and pick an effect.
- Download the image.
Try it free in your browser, nothing is uploaded: https://eskillsfy.com/tools/blur-image
How it works
Each hidden area is a rectangle. The tool clips drawing to that rectangle, then redraws the image either through a blur filter, at a tiny size scaled back up with smoothing off (pixelation), or as a black box.
Pixelation works by shrinking: draw the area into a canvas 1/15th the size, then draw that back at full size with imageSmoothingEnabled = false so each pixel becomes a big block.
Build it yourself
Here is the core of the tool. It has no dependencies unless noted, so you can paste it into any TypeScript or JavaScript project.
pixelate.ts (ts)
export function pixelate(g: CanvasRenderingContext2D, img: HTMLImageElement, x: number, y: number, w: number, h: number, block = 15) {
const small = Object.assign(document.createElement("canvas"), { width: Math.max(1, Math.round(w / block)), height: Math.max(1, Math.round(h / block)) });
small.getContext("2d")!.drawImage(img, x, y, w, h, 0, 0, small.width, small.height);
g.imageSmoothingEnabled = false;
g.drawImage(small, x, y, w, h);
g.imageSmoothingEnabled = true;
}
export function blurArea(g: CanvasRenderingContext2D, img: HTMLImageElement, x: number, y: number, w: number, h: number, px = 12) {
g.save(); g.beginPath(); g.rect(x, y, w, h); g.clip();
g.filter = `blur(${px}px)`; g.drawImage(img, 0, 0); g.restore();
}
Make it production-ready
- Use black boxes for text: light blur on text can sometimes be reversed.
- Detect faces automatically with the Shape Detection API where available.
Questions
Can blur be reversed?
Strong pixelation and black boxes can’t be undone. Light blur on text can sometimes be guessed, so use Black out for sensitive numbers.
Free, runs in your browser, nothing is uploaded.