JPG to SVG Converter
Trace a JPG into an SVG. It starts on the photo preset, and smoothing helps with JPEG noise. Your picture stays on your device.
https://flxcode.com/jpg-to-svg/
or drop it here, or paste with Ctrl+V
PNG, JPG, WebP, GIF, BMP or AVIF. It never leaves this device.
Tracing turns areas of one color into shapes. It is not a real vector drawing of a photo. Logos and flat art with few colors work best, and photos become a posterized look.
No ads. No account. Nothing you type or record is uploaded. We count page events with a daily code. Check it.
Problem or idea? Email us
Quick start
- Choose a JPG or JPEG file, or drop it here.
- Start with "Photo-ish" for photos and scans, or pick Logo if the JPG is a flat logo you only have as a JPG.
- Raise Smoothing if you see specks around edges. Lower Colors until the preview starts to lose areas you care about.
- Download the SVG, or copy the code.
Why a JPG is harder than a PNG
JPG squeezes a picture by blurring small differences. Around every sharp edge it leaves faint noise, a few pixels that are slightly off. A tracer sees that noise as many tiny color areas. With too many colors, the SVG fills up with specks and gets big.
Two things fix most of it. Ask for no more colors than the picture really has, and add a little smoothing. Smoothing blurs the noise and keeps strong edges. A photo will still look posterized, because a photo is made of gradients, not flat areas.
Worked examples
These pictures are made in code with known shapes, and traced by the same engine as the tool above, when this page was built. The numbers are what the tool gives you.
The same 80 x 80 badge as a PNG would have it, with the kind of noise JPEG leaves near edges added (every color channel moved by up to 14, the same every time). The real picture has 3 colors.
Asked is the Colors setting, Smooth is Smoothing, Used is how many colors ended up in the SVG.
| Asked | Smooth | Used | Shapes | Size |
|---|---|---|---|---|
| 3 | 0 | 3 | 4 | 802 bytes |
| 4 | 0 | 4 | 6 | 8.75 KB |
| 6 | 0 | 6 | 119 | 11.1 KB |
| 6 | 2 | 5 | 41 | 3.84 KB |
| 8 | 2 | 7 | 59 | 4.13 KB |
At 3 colors the noise is absorbed: 4 shapes, the same as the clean badge. Asking for 6 colors lets the noise become its own colors, and the result is 119 shapes and 11.1 KB, 14 times bigger. Smoothing 2 cuts that to 41 shapes and 3.84 KB, still more than the clean trace.
- 3 colors, 802 bytes
- 6 colors, 11.1 KB
- 6 colors, smoothing 2, 3.84 KB
A photo-like case: a smooth fade from dark blue to light blue (100 x 64 px) has no edges at all, so every color becomes one vertical band, and shapes equal colors.
| Colors | Shapes | SVG size |
|---|---|---|
| 2 | 2 | 239 bytes |
| 4 | 4 | 449 bytes |
| 8 | 8 | 906 bytes |
| 16 | 16 | 1.63 KB |
The size grows with the number of bands. Real photos need more colors, and every color also adds shapes, which is why photo traces get large fast.
What the sliders do to a JPG
Smoothing runs a blur of radius 1 to 5 px before the colors are grouped. A pixel keeps its own color if the blur would move it too much, so strong edges stay sharp and noise melts away. Colors decides how many flat shades the picture is reduced to. Detail decides how small a speck may be before it is dropped.
The photo preset uses more colors and some smoothing. That gives you bands of color that follow the light in the picture, which is the look people call posterized or paper-cut. Use it for art, not for a copy you need to match.
Numbers this uses
- Smoothing is a Gaussian blur of radius 0 to 5 px. A pixel the blur would change by more than 40 (added over red, green, blue and alpha) keeps its original color.
- Regrouping: 3 rounds of moving each pixel to the nearest color and averaging the colors (imagetracerjs). If 98% of the pixels are within 24 of a chosen color, the colors are kept exactly and the rounds are skipped.
- Colors: 2 to 64. Starting colors are the most common ones that differ by at least 64, relaxing to 20 when the picture needs it. That is why 40 colors on a simple picture gives fewer.
- Size: a longer side above 1000 px is scaled down before tracing. The SVG scales back up because it has a viewBox.
- Detail 1 to 5 drops edge loops under 48, 24, 10, 4, 2 points and allows 3, 2, 1, 0.5, 0.25 px of curve error.
- Transparent pixels (alpha under 128) stay empty. A JPG has none, so this matters only for WebP or PNG files.
- Tracer: imagetracerjs 1.2.6 by András Jankovics, public domain (Unlicense). We use its color grouping and shape finding and write the SVG ourselves.
Privacy
The picture is traced in your browser and is not uploaded or stored. The tool counts events without cookies, such as "SVG saved", and never a file name, size or setting (details). Licences: Open source used on this site.
FAQ
Can a JPG become a real vector image?
Not a true one. A JPG is a photo made of pixels, and a vector is made of shapes. Tracing makes shapes from areas of similar color. For a logo you only have as a JPG the result can be very good. For a photo you get a poster-style version.
Why do I get specks and a huge file from my JPG?
JPEG compression leaves faint noise near edges, and asking for too many colors turns that noise into tiny shapes. Lower Colors to what the picture really has and add Smoothing 1 or 2. The stats line shows the new size at once.
What settings work for a photo?
Photo-ish: about 32 colors, smoothing 2, detail 2. For a smaller file try 12 to 16 colors. For more of the light and shadow, go to 48 or 64 colors, and expect a file of several hundred KB.
What settings work for a scanned drawing or signature?
Set Colors to 2, Smoothing to 1 and Detail to 3. A black-ink drawing on white paper then becomes one black shape on a white shape. Delete the white shape in your editor if you need a transparent background.
Does it keep the colors of my JPG?
It picks the main colors of the picture and averages the pixels near each one, so the colors are close but not exact. Color profiles and EXIF data such as location are not carried into the SVG.
Why is my JPG scaled down?
Tracing a big picture is slow on a phone, so the longer side is capped at 1000 px for tracing. The SVG gets the original width and height, and because it is vector you can still make it as big as you like.
Does the file name or the picture go to a server?
No. The JPG is decoded and traced in your browser. Nothing is uploaded or saved. When you open a file we count one event with the word "jpg", never the name or the size.
More from FLXCode
PNG to SVG ConverterNew
Trace a PNG logo or icon into an SVG you can scale to any size. Choose the colors. Nothing is uploaded.
Image to SVG ConverterNew
Trace a PNG, JPG, WebP or GIF into an SVG. Tune colors, smoothing and detail. Nothing is uploaded.
SVG to PNG ConverterNew
Turn an SVG file or code into a PNG at the size you choose, transparent or on a color. Runs in your browser.
HEIC to JPG ConverterNew
Convert iPhone HEIC photos to JPG in your browser. Nothing is uploaded, and it works offline.