JPG to SVG: Raster to Vector Conversion Explained

Raster images like JPG store pictures as grids of colored pixels. Vector images like SVG store them as mathematical curves. Converting between the two is not a simple format change — it is a fundamentally different way of representing an image. This guide explains how auto-vectorization works, what types of images produce great results, and when vectorization is the wrong tool for the job.

Vectorize Your Image

Upload a JPG and get a scalable 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.

Raster vs Vector: The Fundamental Difference

Every digital image falls into one of two categories: raster or vector. Understanding the difference is essential to knowing what vectorization can and cannot do.

A raster image (JPG, PNG, BMP, TIFF) stores a picture as a rectangular grid of colored pixels. Each pixel is a tiny square with a single color value. The total number of pixels — the resolution — determines how much detail the image can hold. A 3000×2000 pixel photo contains 6 million individual color values. When you zoom in, you eventually see the individual squares. When you scale the image up beyond its native resolution, the software must invent new pixels between the existing ones, producing a blurry, interpolated result.

A vector image (SVG, AI, EPS, PDF) stores a picture as a set of mathematical instructions. A circle is described as a center point and a radius. A curve is a Bézier equation with control points. A filled region is a closed path with a fill color. Because the image is defined by math rather than pixels, it can be rendered at any resolution — from a 16×16 favicon to a 10-meter billboard — with perfect sharpness every time. The rendering engine simply recalculates the curves for the target size.

Property Raster (JPG, PNG) Vector (SVG)
Data modelGrid of colored pixelsMathematical paths and curves
ScalingDegrades when enlargedInfinitely scalable, always sharp
File sizeProportional to pixel countProportional to path complexity
Best forPhotographs, complex scenesLogos, icons, illustrations, line art
EditingPixel-level (Photoshop, GIMP)Path-level (Illustrator, Inkscape)
TransparencyPNG yes, JPG noFull support
AnimationNot nativelyCSS and JavaScript

This fundamental difference means that converting from raster to vector is not like converting WAV to MP3 or JPG to PNG. Those are format changes within the same data model (pixels to pixels, or samples to samples). Raster-to-vector conversion is a reconstruction — the software must interpret the pixel data and build a completely new mathematical representation of the image.

How Auto-Vectorization Works

When you upload a JPG image to Convertio and convert it to SVG, the file passes through a multi-step pipeline. Understanding each step helps explain why certain images vectorize beautifully while others produce unexpected results.

Step 1: Bitmap Conversion

The input image (JPG, PNG, or any supported raster format) is first converted to a raw bitmap using ImageMagick. This step decodes the compressed image into an uncompressed pixel grid that the tracing algorithm can process. Any format-specific features (JPEG compression artifacts, PNG alpha channels, EXIF metadata) are stripped away, leaving a clean bitmap.

Step 2: Thresholding (Grayscale to Binary)

Potrace, the tracing engine, works with two-tone (binary) images — every pixel is either black or white. The grayscale bitmap is converted to binary using a brightness threshold. Each pixel's brightness is compared against the threshold value (0.0 to 1.0, default 0.5):

  • Pixels darker than the threshold become black (foreground)
  • Pixels lighter than the threshold become white (background)

This is the most critical step in the pipeline. The threshold determines how much of the original image is captured as foreground. A threshold of 0.3 captures only the darkest elements; 0.7 captures most of the image, producing heavier output.

Step 3: Edge Tracing

Potrace scans the binary bitmap and identifies boundaries between black and white regions. It follows these boundaries pixel by pixel, building a raw contour of each shape. The algorithm handles nested shapes (a white region inside a black region inside another white region) by tracking the hierarchy of inside/outside relationships.

Step 4: Bézier Curve Fitting

The raw pixel contours from Step 3 are jagged staircase shapes. Potrace fits smooth Bézier curves to these contours, replacing staircase edges with clean mathematical curves. The curve-fitting algorithm minimizes the error between the original pixel boundary and the fitted curve while keeping the path description compact.

Two parameters control this process:

  • Corner smoothing (-a): Controls whether corners are rendered as sharp angles or smooth curves. A value of 0 preserves all corners; 1.334 smooths everything.
  • Optimization (-O): Controls how aggressively potrace simplifies curves. Higher values produce simpler paths with fewer control points but potentially less accurate tracing.

Step 5: SVG Output

The fitted Bézier curves are written as SVG path elements — standard XML that any browser, design tool, or cutting machine can render. The complete command pipeline looks like this:

Pipeline: convert input.jpg BMP:- | potrace -s --opaque -o output.svg
ImageMagick converts the input to BMP, which is piped directly to potrace. The -s flag requests SVG output. --opaque fills the background with white instead of leaving it transparent.

What Vectorizes Well

The binary thresholding step is the key to understanding which images produce excellent SVG output. Images that naturally divide into clear light and dark regions — with strong edges and minimal gradation — map perfectly to the black/white binary that potrace processes.

Image Type Quality Why
Logos on white backgroundExcellentHigh contrast, clean edges, solid colors
Line art and sketchesExcellentStrong black lines on white paper
Text and typographyExcellentSharp edges, uniform color
SilhouettesExcellentPure black/white, clean outlines
Simple iconsExcellentGeometric shapes, solid fills
Stamps and sealsVery goodHigh contrast, may need threshold adjustment
Hand-drawn designsVery goodStrong lines vectorize well; light pencil strokes may drop out
Technical diagramsVery goodClean lines, but thin lines may need lower threshold

The common thread: high contrast, clear edges, limited tonal range. If you can squint at the image and still make out its essential shape, it will vectorize well.

What Does NOT Vectorize Well

The same thresholding process that works brilliantly for logos and line art fails for images with continuous tonal variation. When an image contains millions of subtle color and brightness transitions, forcing every pixel into either black or white destroys the visual information that makes the image meaningful.

  • Photographs: A portrait or landscape contains smooth gradients across skin, sky, foliage, and fabric. Thresholding collapses all of this into stark black and white regions, producing an abstract or posterized appearance. The SVG file may also be enormous — thousands of tiny paths attempting to represent what was originally smooth tonal variation.
  • Complex scenes: Busy images with many overlapping elements, varying depths, and complex backgrounds produce noisy, cluttered vector output with too many paths to be useful.
  • Soft gradients: A sunset sky, a color fade, or a vignette effect cannot be represented as binary black/white. The gradient gets chopped into discrete bands with jagged boundaries.
  • Detailed textures: Fabric weave, wood grain, skin pores, fur — these fine-detail textures generate enormous numbers of tiny vector paths that neither look good nor serve any practical purpose.
  • Low-resolution images: A 100×100 pixel thumbnail gives the tracer so few pixels to work with that the curves become rough and blocky. Higher resolution input always produces smoother output.
  • Heavily compressed JPGs: JPEG compression artifacts (blocky patterns around edges) confuse the edge detection, producing noisy vector paths that trace the compression artifacts rather than the actual image content.

Rule of thumb: If the image looks good in black and white — if its essential meaning survives when you remove all gray tones — it will vectorize well. If the image depends on gradients, tonal subtlety, or photographic detail, vectorization is the wrong tool.

Our Potrace Pipeline

Convertio uses potrace (Polygon Tracer), created by Peter Selinger, for raster-to-vector conversion. Potrace is the same engine used by Inkscape's "Trace Bitmap" feature and is widely regarded as the best open-source auto-tracer available.

The conversion pipeline has three components:

  1. ImageMagick convert — Decodes the input file (JPG, PNG, WebP, TIFF, PSD, etc.) and converts it to a raw BMP bitmap that potrace can process
  2. Pipe (|) — The BMP data is streamed directly to potrace without writing a temporary file, keeping the process fast and memory-efficient
  3. potrace — Traces the bitmap contours and outputs an SVG file with clean Bézier curves

The full command:

convert input.jpg BMP:- | potrace -s --opaque -o output.svg

This default configuration uses a threshold of 0.5, moderate corner smoothing, and standard optimization. For most logos, line art, and simple graphics, the defaults produce excellent output without any parameter tuning.

Vectorization Settings Explained

Potrace offers several parameters that control the quality and character of the vector output. Understanding these settings helps you get the best results for different types of source images.

Threshold (-k)

The most important parameter. Controls the brightness cutoff between black (foreground) and white (background) in the binary conversion step. Range: 0.0 to 1.0, default 0.5.

Threshold Effect Best For
0.2Very light — only the darkest pixels become foregroundDark images, heavy ink drawings
0.3Light sketch feelPencil drawings, low-contrast sources
0.5Balanced default — equal splitMost logos and line art
0.7Heavier — captures more of the imageLight-colored sources, faded documents
0.9Very heavy — almost everything becomes foregroundExtracting faint marks from light backgrounds

Corner Smoothing (-a)

Controls whether the tracer preserves sharp corners or rounds them into curves. Range: 0 to 1.334, default 1.

  • -a 0 — All corners are sharp. Good for geometric shapes, pixel art, and technical diagrams where you want precise angles.
  • -a 1 (default) — Moderate smoothing. Corners that are close to 90 degrees stay sharp; others get rounded.
  • -a 1.334 — Maximum smoothing. All corners become curves. Produces the smoothest output, good for organic shapes and handwriting.

Noise Removal (-t turdsize)

Removes small isolated specks from the binary image before tracing. The value specifies the maximum size (in pixels) of regions to discard. Default: 2.

  • -t 0 — Keep everything, including single-pixel noise. Use this only for very clean source images.
  • -t 2 (default) — Removes tiny specks (1-2 pixel regions). Works for most images.
  • -t 10-50 — Aggressively removes small features. Useful for scanned documents with dust, paper texture, or compression artifacts.

Optimization (-O)

Controls how many Bézier curve segments potrace uses to approximate each contour. Higher optimization produces simpler paths (fewer SVG bytes) but potentially less accurate tracing. The default optimization level is a good balance between fidelity and file size for most images.

When to Vectorize

Vectorization is not a universal upgrade — it is the right tool for specific use cases where the properties of vector graphics provide a clear advantage over raster images.

Large-Format Printing

Banners, trade show displays, vehicle wraps, and building signage all require artwork that can be scaled to meters without losing quality. A logo that was designed at 300×200 pixels becomes a blurry mess on a 3-meter banner. Converting it to SVG gives the print shop a resolution-independent file that renders crisply at any scale.

Scalable Icons and UI Elements

Websites and applications display icons at many sizes: 16px in menus, 32px in toolbars, 64px in feature cards, 128px in hero sections. Serving a separate PNG for each size is wasteful. A single SVG icon renders perfectly at every size, responds to CSS styling (change colors on hover), and typically weighs less than a single PNG rendition.

Scanned Line Drawings

Architects, engineers, and artists often scan hand-drawn sketches, floor plans, or technical diagrams. The scanned JPG is a raster capture of something that was originally drawn with lines and curves — exactly what vector format represents natively. Vectorizing the scan reconstructs the original intent, producing clean, editable vector paths from the scanned pixel data.

Cutting Machines and CNC

Cricut, Silhouette, laser cutters, and CNC routers all require vector input to generate toolpaths. If your design exists only as a JPG or PNG, vectorization is the bridge between the raster design and the physical cutting operation. The vector paths become the exact lines the machine follows.

Embroidery and Screen Printing

Embroidery machines need vector outlines to generate stitch paths. Screen printing requires clean vector separations for each color layer. In both cases, vectorizing a raster logo or design is the first step in the production workflow.

AI-Powered Alternatives

Potrace is a traditional algorithmic tracer — it detects edges and fits curves using mathematical optimization. It excels at black-and-white output from high-contrast sources, and it is fast, free, and deterministic (same input always produces the same output).

For use cases that potrace cannot handle well, AI-powered vectorizers offer a different approach:

Feature Potrace (Convertio) AI Vectorizers
Color outputBlack & white (single threshold)Full multi-color
SpeedInstant (milliseconds)Seconds to minutes
CostFreeTypically paid (per-image or subscription)
Best forLogos, line art, B&W graphics, cuttingMulti-color illustrations, stylized photos
DeterministicYes — same input, same outputMay vary between runs
Offline capableYes (potrace runs locally)Usually cloud-only

Tools like Vectorizer.AI and Recraft use machine learning to identify shapes, separate color layers, and generate clean multi-color SVG output from complex images. They can handle full-color logos, illustrations with gradients, and even some photographic content that potrace cannot.

However, for the most common vectorization use cases — converting a B&W logo, tracing a line drawing, creating SVG cut files for Cricut, or vectorizing scanned text — potrace produces excellent results instantly and for free. It remains the engine behind Inkscape's Trace Bitmap, one of the most widely used vectorization tools in the world.

Pre-Processing Tips for Better Results

The quality of your SVG output depends heavily on the quality of your input image. A few minutes of preparation before uploading can dramatically improve the vectorization result.

  • Increase contrast: Open the image in any editor (even a phone's built-in editor) and push the contrast slider up. Stronger contrast means clearer edges for the tracer to follow.
  • Crop tightly: Remove unnecessary background. Fewer irrelevant pixels means cleaner output and smaller SVG files.
  • Use the highest resolution available: A 2000×2000 pixel image gives the tracer 4x more edge data than a 1000×1000 version. More pixels means smoother curves.
  • Prefer PNG over JPG when possible: JPEG compression creates blocky artifacts around edges. These artifacts confuse the tracer, producing noisy vector paths. If you have both formats available, use the PNG.
  • Convert to grayscale first: If the image is naturally B&W (like a sketch or logo), explicitly converting to grayscale before uploading removes any color noise that could affect thresholding.
  • Remove background noise: For scanned documents, use a "levels" or "curves" adjustment to push the paper white to pure white and the ink to pure black. This eliminates paper texture and scanning artifacts.

Ready to Vectorize?

Convert your JPG image to scalable SVG

JPG SVG

Tap to choose your file

or

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

Frequently Asked Questions

Technically yes, but the result will be a stylized interpretation, not a photorealistic copy. Photographs contain millions of subtle color transitions, gradients, and textures that the vectorizer converts into thousands of tiny solid-color paths. The output looks posterized or artistic. For photorealistic scaling, use an AI upscaler instead. Vectorization works best for logos, line art, text, and graphics with solid colors and clear edges.

Potrace produces black-and-white SVG output by default. It converts your image to a binary (two-tone) bitmap based on a brightness threshold, then traces the boundary between black and white regions. For multi-color vectorization, you need software like Vectorizer.AI or Adobe Illustrator's Image Trace, which run multiple passes at different color layers.

The default threshold of 0.5 works well for most images. Lower values (0.2-0.4) capture only the darkest areas, producing lighter output ideal for pencil sketches. Higher values (0.6-0.8) capture more of the image, producing heavier output for light-colored source material. Experiment with small adjustments to find the sweet spot for your specific image.

Yes, that is the primary advantage of SVG. Because the image is stored as mathematical paths and curves rather than pixels, it renders perfectly at any resolution — from a 16-pixel favicon to a 10-meter billboard. This makes SVG ideal for logos, signage, vehicle wraps, and any application where the image must work at multiple sizes.

A JPG logo is trapped at a fixed resolution. Enlarging it for a banner, business card, or website header makes it blurry. Converting to SVG gives you a resolution-independent version that stays crisp at any size. SVG logos can also be styled with CSS, animated with JavaScript, and embedded directly in HTML — making SVG the standard format for professional branding.

More JPG to SVG Guides

Potrace Threshold Settings: Image to SVG Quality Guide
Potrace threshold 0.0-1.0 explained with visual examples. Corner smoothing, noise removal, and best practices.
Back to JPG to SVG Converter