Potrace Threshold Settings: Image to SVG Quality Guide

The threshold parameter is the single most important setting in potrace vectorization. It controls which pixels become foreground (black) and which become background (white), directly determining the weight, detail, and accuracy of your SVG output. This guide explains every potrace setting and provides optimal values for different source image types.

Convert JPG to SVG

Upload your image and get a vectorized SVG

JPG SVG

Tap to choose your file

or

Supports M4A, WAV, FLAC, OGG, AAC, WMA, AIFF, OPUS • Max 100 MB

Encrypted upload via HTTPS. Files auto-deleted within 2 hours.

What Is the Potrace Threshold?

Before potrace can trace the edges of an image, it must reduce the image to just two colors: black (foreground) and white (background). This is called binarization. The threshold parameter (-k) controls where the dividing line falls on the brightness scale.

Every pixel in the source image has a brightness value. In a grayscale image, this ranges from 0 (pure black) to 1 (pure white), with 0.5 being medium gray. The threshold value determines the cutoff:

  • Pixels with brightness below the threshold → become black (included in the vector trace)
  • Pixels with brightness above the threshold → become white (ignored)

The default threshold is 0.5, which splits the brightness range exactly in half. This works well for most high-contrast images, but adjusting the threshold can dramatically improve results for specific source types.

Technical note: For color images, potrace first converts to grayscale using a luminance formula (weighted RGB: 0.2126R + 0.7152G + 0.0722B) before applying the threshold. This means color information affects which pixels end up as foreground.

Visual Comparison at Different Thresholds

To understand the impact of threshold settings, consider how the same source image looks when traced at different values. The descriptions below apply to a typical grayscale image with a mix of light and dark elements:

Threshold Visual Result What Gets Captured
0.2 Very light — minimal foreground Only the absolute darkest pixels (deep blacks, heavy shadows). Most of the image appears as blank white space. Useful for extracting only the boldest, highest-contrast elements from a noisy image.
0.3 Light sketch feel Dark areas and strong mid-tones. Light grays and medium tones are dropped. Produces a delicate, sketch-like result that captures primary contours but not fine detail or subtle shading.
0.5 Balanced (default) Everything darker than medium gray becomes foreground. Provides the most natural-looking binary representation for most images. The go-to starting point for logos, line art, and general graphics.
0.7 Heavier — more foreground Most of the image becomes foreground, with only the lightest areas remaining white. Good for recovering detail from light-colored source images, faded documents, or pencil sketches that were too light at 0.5.
0.9 Very heavy — nearly solid Almost everything becomes black foreground. Only near-white pixels remain as background. Useful for extracting very faint marks from a white background, but usually produces an overly heavy, detail-obscuring result.

The key insight: lower thresholds produce lighter output with less detail; higher thresholds produce heavier output that captures more of the image. There is no universally "correct" threshold — it depends entirely on the brightness distribution of your source image and the result you want.

Other Potrace Parameters

While the threshold has the biggest impact on the output, potrace offers several additional parameters that fine-tune the vector result.

Corner Smoothing (-a alpha)

Controls whether corners in the traced contour are rendered as sharp angles or smoothed into curves. The value ranges from 0 to 1.334:

  • -a 0 (sharp corners) — Every corner in the binary contour is preserved as a sharp angle in the SVG. This produces angular, precise output. Best for geometric shapes, pixel art, QR codes, and technical diagrams where you want exact right angles.
  • -a 1 (default) — Moderate smoothing. Corners close to 90° are preserved; obtuse angles get smoothed into curves. This provides a good balance for most use cases — text stays readable, organic shapes feel natural.
  • -a 1.334 (maximum smoothing) — All corners are rounded into curves, even sharp ones. Produces the smoothest, most fluid output. Ideal for handwriting, organic shapes, and artistic interpretations where angular artifacts would look unnatural.

Path Optimization (-O)

Controls how aggressively potrace simplifies the Bézier curves that form each path. Higher optimization levels produce SVG files with fewer control points (smaller file size) at the cost of potentially less accurate tracing. The default level provides a good balance between fidelity and compactness.

In practice, this parameter rarely needs adjustment. The default optimization produces compact, accurate paths suitable for both display and cutting machine applications. Increasing optimization can help if your SVG file is unusually large (thousands of complex paths from a photograph trace), but for typical logos and line art, the default is optimal.

Noise Removal (-t turdsize)

Before tracing, potrace removes small isolated regions (called "turds" in the potrace documentation) from the binary image. The turdsize value specifies the maximum area in pixels of regions to discard:

  • -t 0 — Keep everything. No noise removal at all. Even single stray pixels will be traced into tiny vector paths.
  • -t 2 (default) — Remove isolated regions of 1-2 pixels. Eliminates most scanner noise and JPG compression artifacts without affecting real image content.
  • -t 10 — Remove small specks up to 10 pixels. Good for scanned documents with visible paper texture.
  • -t 50 — Aggressive removal. Eliminates larger artifacts but may also remove small intentional details like punctuation marks or fine decorative elements.

Turdsize tip: If your SVG output has many tiny scattered vector fragments that aren't part of the actual design, increase the turdsize. If small intentional details (dots, thin strokes) are disappearing, decrease it or set it to 0.

Best Practices by Source Image Type

Different types of source images require different combinations of potrace settings. The table below provides recommended starting points for the most common scenarios:

Source Image Threshold (-k) Corners (-a) Turdsize (-t) Notes
Clean logo (B&W) 0.5 1 (smooth) 2 (low) Default settings work perfectly for high-contrast logos on white backgrounds
Pencil sketch 0.35–0.45 1.334 (max smooth) 0 (none) Lower threshold to avoid capturing paper texture as noise; max smoothing for fluid lines
Ink stamp / seal 0.55–0.65 1 (smooth) 10–20 (high) Slightly higher threshold captures the full stamp; high turdsize removes ink spatter
Low-contrast photo 0.3–0.4 1 (smooth) 10–50 (high) Lower threshold preserves separation; high turdsize removes noise from gray areas
High-contrast art 0.5 0 (sharp) 2 (low) Sharp corners preserve geometric precision; default threshold for clear B&W contrast
Scanned document 0.5–0.6 0 (sharp) 5–15 Sharp corners for text legibility; moderate turdsize for paper dust and scanner artifacts
Faded / light source 0.65–0.8 1 (smooth) 2–5 Higher threshold captures light-colored content that would be lost at 0.5
Pixel art / QR code 0.5 0 (sharp) 0 (none) Sharp corners preserve pixel-perfect geometry; no noise removal to keep every intentional pixel

Pre-Processing Tips

Adjusting potrace parameters helps, but the biggest improvements come from preparing the source image before conversion. These pre-processing steps can be done in any image editor — even a phone's built-in editor.

Increase Contrast

The most effective single improvement. Open the image in any editor and push the contrast slider up. This widens the gap between light and dark pixels, making edge detection cleaner and more accurate. For B&W images, using a "Levels" or "Curves" adjustment to push blacks darker and whites brighter produces even better results than a simple contrast slider.

Remove Background Noise

For scanned documents and photos of physical objects, the background is rarely pure white. Paper texture, uneven lighting, shadows, and dust all introduce gray pixels that potrace may interpret as foreground. Before uploading:

  • Use a "Levels" adjustment to push the background toward pure white
  • Apply a slight Gaussian blur (1-2 pixel radius) to smooth out paper texture without affecting major edges
  • Crop tightly to remove shadows and edge artifacts from scanning

Use PNG Instead of JPG

JPEG compression creates visible blocky artifacts around sharp edges — exactly the areas that potrace analyzes for edge tracing. These artifacts cause the tracer to follow the JPEG compression boundaries instead of the actual image edges, producing jagged, noisy vector paths. If you have the option, always use a PNG source. If only JPG is available, use the highest quality (least compressed) version.

Use Higher Resolution

Potrace fits Bézier curves to pixel boundaries. More pixels means more data points for the curve-fitting algorithm, which produces smoother, more accurate curves. A 2000×2000 pixel image will produce noticeably smoother SVG output than a 500×500 version of the same content. When possible, upload the largest version of your image available.

Convert to Grayscale First

If your source image is fundamentally black-and-white (a logo, text scan, or line drawing), converting it to grayscale before uploading removes any color noise that might affect the threshold calculation. Color images are converted to grayscale internally using a luminance formula, but this conversion can sometimes produce unexpected brightness values if the image has colored elements with similar luminance.

Ready to Convert?

Vectorize your JPG image to SVG

JPG SVG

Tap to choose your file

or

Supports M4A, WAV, FLAC, OGG, AAC, WMA, AIFF, OPUS • Max 100 MB

Frequently Asked Questions

For most logos on a white background, the default threshold of 0.5 works well. If your logo has light-colored elements that are dropping out, increase the threshold to 0.6 or 0.7 to capture more of the image. If the background has slight gray tones appearing as unwanted black regions, decrease to 0.4. Always start at 0.5 and adjust in small increments.

In Inkscape, yes — open your image with File > Import, then use Path > Trace Bitmap. The dialog lets you adjust the threshold with a live preview before committing. Convertio uses the potrace default of 0.5, which produces optimal results for most source images without manual tuning. For quick adjustments, increasing contrast in your source image before uploading often produces better results than threshold tweaking.

Rough edges in SVG output usually indicate a low-resolution source image. Potrace fits curves to pixel boundaries, so fewer pixels means coarser curves. Upload the highest resolution version available. JPEG compression artifacts can also cause jagged edges — the tracer follows the blocky artifact boundaries instead of the actual image edges. Using a PNG source eliminates this issue.

Turdsize (-t) is potrace's noise removal parameter. It specifies the maximum area in pixels of isolated regions to discard before tracing. The default value of 2 removes single-pixel specks. For scanned documents with visible paper texture or dust, increase to 10-50 to eliminate small artifacts. For very clean digital images, the default is sufficient.

More JPG to SVG Guides

JPG to SVG: Raster to Vector Conversion Explained
How auto-vectorization works with potrace. What vectorizes well, what doesn't, and settings for best results.
Back to JPG to SVG Converter