> [Site index](https://perfectvector.com/llms.txt) — available pages and descriptions.

# Remove Paper Texture From a Scan Before Vectorizing

> Clean grain and uneven paper shading from scanned line art. Compare a global threshold with local cleanup and check that faint marks survive in the SVG.

Source: https://perfectvector.com/blog/remove-paper-texture-before-vectorizing

Language: en
Author: Irene Kim
Published: 2026-11-18T08:00:00+09:00

Remove paper texture on a copy of the scan before you trace the drawing. If a global black-and-white threshold turns a dark corner into specks while erasing faint lines on a bright part of the page, clean up small grain and estimate the background locally. Compare the result with the original at the thinnest mark you need to keep.

## Tell paper grain from a shadow

Start with two crops. Choose one where the page should be blank, and a second with a delicate pencil stroke or a small break between lines. At 100%, grain appears as fine variation from pixel to pixel. A shadow changes brightness across a much wider area. Both can turn into black shapes when the tracing tool reads a two-tone image.

Test a global threshold first. It applies the same brightness cutoff across the image. If the background in both crops turns white and the faint stroke stays visible, the scan may be ready to trace. GIMP's Threshold tool lets you preview the black-and-white change. [GIMP Threshold documentation](https://docs.gimp.org/3.0/en/gimp-tool-threshold.html)

## Use local cleanup when the page brightness varies

1. **Keep a copy of the original.** Crop away the scanner bed and paper border on a working copy. Keep any reference marks you need beside the drawing.
2. **Reduce fine grain.** Test a small median filter, which replaces each pixel with the middle brightness of its neighborhood. Start with the smallest neighborhood and recheck the thinnest line. A filter that cleans the paper can also remove dots or narrow strokes. [Pillow image filter reference](https://pillow.readthedocs.io/en/stable/reference/ImageFilter.html)
3. **Estimate the paper brightness near each mark.** Use a maximum filter with a window wider than the thin strokes, then smooth its output to estimate slow changes in the paper. Subtract the working image from this estimate. Dark marks stand out when they sit on lighter nearby paper, even in a dim corner. [Pillow channel operations reference](https://pillow.readthedocs.io/en/stable/reference/ImageChops.html)
4. **Threshold the resulting difference.** Keep pixels that are substantially darker than the nearby paper. Leave the mask black on white for tracing, then compare the two crops again. If a heavy filled area loses its center, try a larger background window or keep that area from a separate mask.

### Reproduce the local cleanup with Pillow

This example uses Python with Pillow and a grayscale copy named `scan.png`. The settings are from the 960 × 575 pixel drawing below. On a different scan, adjust the cutoff as you compare the blank area and faint stroke.

```python
from PIL import Image, ImageChops, ImageFilter

scan = Image.open("scan.png").convert("L")
quiet = scan.filter(ImageFilter.MedianFilter(3))
paper = quiet.filter(ImageFilter.MaxFilter(19))
paper = paper.filter(ImageFilter.GaussianBlur(15))
difference = ImageChops.subtract(paper, quiet)
mask = difference.point(lambda value: 0 if value >= 42 else 255)
mask.save("clean.pgm")
```

The `42` is a difference in grayscale brightness. Increase it to reject weaker marks, or decrease it to retain fainter ones. Once the mask looks right, open it in a vector editor that can trace bitmaps, or use Potrace to get editable paths. [Potrace manual](https://potrace.sourceforge.net/potrace.1.html)

```sh
potrace --svg --turdsize 2 --output cleaned.svg clean.pgm
```

## Compare the paper and the faintest line in the traced SVG

We drew a stem with thin leaf veins and added digital grain and a broad shadow to simulate a scan. We saved three masks of that same image and traced each with Potrace 1.16 using identical settings. We rendered the SVGs at the original pixel size and counted dark pixels in the known paper and vein regions. The paper count excludes the one-pixel border next to the original lines.

| Mask before tracing                    | Dark pixels in the paper region | Leaf-vein pixels retained out of 4,518 |
| -------------------------------------- | ------------------------------: | -------------------------------------: |
| Global threshold at 125                |                          36,454 |                                  2,443 |
| Global threshold at 158                |                         106,367 |                                  4,241 |
| Median filter and local paper estimate |                               1 |                                  4,398 |

**Same drawing, different masks**

![A simulated leaf drawing scan, a global-threshold SVG with dark speckling and dotted veins, and a local-cleanup SVG with a clear background and mostly continuous veins.](https://perfectvector.com/blog/remove-paper-texture-before-vectorizing/paper-texture-trace.webp)

*The center SVG used a global threshold at 125. The right SVG used a local estimate for the paper brightness. The enlarged strip shows the same detail in each panel.*

A higher global threshold kept more of the veins and also picked up more of the shaded paper. Local cleanup kept more veins in this simulated example, but still lost some fine-line pixels after tracing. The count describes this drawing and these settings. Visible continuity, open gaps, and recognizable detail matter more than getting the same numbers.

## Decide when to stop cleaning

Open the resulting SVG over a light background and inspect the blank area for stray shapes. Check the top and bottom of the same thin stroke for breaks. Compare small marks against the original before deleting them. Dark pencil shading, textured outlines, and intentional stippling may be part of the drawing. If their tone matters, consider keeping that part as raster art.

When you have a clean raster copy, you can [convert the cleaned line drawing to vector paths](https://perfectvector.com/image-to-vector). For general setup, see the [line-art tracing guide](https://perfectvector.com/blog/line-art-to-svg). If the scan includes printed blue rules instead of neutral grain, use the [blue-line cleanup workflow](https://perfectvector.com/blog/remove-blue-lines-before-tracing).

## FAQ

### Why does my vector trace have hundreds of tiny shapes?

The tracing tool may be following paper grain, dust, or shaded areas that turned dark in the mask. Clean a copy of the scan before tracing again, then inspect regions that should be blank.

### Will a stronger blur remove all the texture?

A stronger blur mixes more of the surrounding pixels into the drawing and may weaken small marks. Start with a small filter and inspect an enlarged crop next to the original.

### Can I keep pencil shading and still remove the paper?

A two-tone mask turns shading into solid shapes, gaps, or specks depending on the cutoff. Keep a cleaned raster copy when gradual pencil shading is part of the artwork. Use a separate vector trace for the outlines if that helps the job.

## Sources

1. [GIMP — Threshold](https://docs.gimp.org/3.0/en/gimp-tool-threshold.html) — previewing how an intensity range becomes a black-and-white mask.
2. [Pillow — ImageFilter](https://pillow.readthedocs.io/en/stable/reference/ImageFilter.html) — the median, maximum, and Gaussian filters in the example.
3. [Pillow — ImageChops](https://pillow.readthedocs.io/en/stable/reference/ImageChops.html) — subtracting the working image from the background estimate.
4. [Potrace — Command-line manual](https://potrace.sourceforge.net/potrace.1.html) — tracing a PGM mask to SVG and the speckle-area argument.

***

After the paper is clean, [trace the drawing with PerfectVector](https://perfectvector.com/image-to-vector). Open the SVG over a light background and check the area around the faintest line for stray specks and breaks.

## Explore

- [Read the HTML article](https://perfectvector.com/blog/remove-paper-texture-before-vectorizing)
- [Coloring Page Line Thickness: Check the Printed Size](https://perfectvector.com/blog/coloring-page-line-thickness.md)
- [Scan or Photograph Line Art Before Vectorizing?](https://perfectvector.com/blog/scan-or-photograph-line-art.md)
- [Product facts](https://perfectvector.com/product-facts.md)
- [FAQ](https://perfectvector.com/faq.md)
- [Pricing and credits](https://perfectvector.com/pricing.md)
