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

# Convert a QR Code Image to SVG and Verify the Scan

> Turn an existing QR code image into SVG, preserve the exact encoded text, and check the four-module margin before you send a label or sign to print.

Source: https://perfectvector.com/blog/qr-code-image-to-svg

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

Scan your existing QR code, copy the exact encoded text, and generate a new QR code as SVG. Then place it in the layout and scan it again. For an ordinary black-and-white code, rebuilding gives you a regular grid of square modules and a chance to verify that the destination stayed the same.

A **module** is one square in that grid. The **quiet zone** is the blank margin around it. Leave at least four modules of quiet zone on every side of a standard QR code. Include the margin when you measure or resize the code. [DENSO WAVE QR Code sizing guidance](https://www.qrcode.com/en/howto/code.html)

## Decide what needs to stay the same

| What you have                                         | Best next step                                                 | What to verify                                        |
| ----------------------------------------------------- | -------------------------------------------------------------- | ----------------------------------------------------- |
| A PNG or JPG your scanner can read                    | Decode the original and generate an SVG from its exact content | Same decoded text, square grid, and quiet zone        |
| A code with branded dots, an icon, or a required grid | Request the vector export from the code owner or provider      | Approved design and the same decoded content          |
| An image that fails to decode                         | Request a better source or the exact text from its owner       | A readable original or an owner-confirmed destination |

Pay special attention to campaign links. Your phone may show the final page after a redirect. The code may contain a short URL with a campaign ID. Copy the string reported by a reader before opening the link. When the code belongs to another team, ask them to confirm the full string and whether a re-export is available.

## Rebuild the QR code as an SVG

1. **Read the original image.** Use a reader that displays the decoded text. Save it as your reference, including case, punctuation, query parameters and any trailing slash. If the destination should remain private, use a tool that decodes locally.
2. **Generate a standard QR code from that content.** Pick a generator that can save SVG directly. Use a plain dark code on a solid light background for the first export. A generator can produce a different valid grid for exactly the same data. The Python `qrcode` project supports SVG path output with a white background. [Python QR Code project](https://github.com/lincolnloop/python-qrcode#svg)
3. **Check the exported file.** Open it at high zoom. Look for straight edges, square cells and a clear margin. If an editor shows only a single image object, inspect the SVG for an embedded `<image>` element. An SVG can [contain a raster bitmap](https://perfectvector.com/blog/svg-contains-raster-image). A path or rectangle-based code lets the grid scale as geometry.
4. **Test the placed copy.** Put the SVG into your layout at its intended size. Scan the exported layout and the physical proof under real lighting. Compare what the reader displays with the reference string from step 1.

## What changed in our test

We used a 264-pixel PNG with a 25-module grid and four blank modules around all four sides. OpenCV decoded it as `https://example.org/recipe`. We generated a new SVG with the same payload and a different mask pattern. A mask pattern changes which grid cells are dark, subject to the rules of QR encoding. In this example, 196 cells changed and the payload stayed the same.

![The original QR code beside two rendered sizes of a rebuilt QR code with a different grid](https://perfectvector.com/blog/qr-code-image-to-svg/qr-decode-check.webp)

*The original PNG and two renders of the rebuilt SVG decoded to the same example URL in OpenCV.*

We rendered the SVG at 132, 264 and 396 pixels wide. All three returned the original URL in the same OpenCV decoder. The test covers digital files. Print settings, glare, size, viewing distance and the scanner can change what happens on a physical label. [OpenCV QRCodeDetector](https://docs.opencv.org/4.x/de/dc3/classcv_1_1QRCodeDetector.html)

## Check the quiet zone in the final layout

Measure the blank margin in modules. On a 25-module code with four blank modules per side, the full square is 33 modules wide. If the full artwork is 33 mm wide, a module is 1 mm and the quiet zone is 4 mm per side. Pick the final size by testing the artwork at the distance and contrast the reader will encounter.

Keep the logo, color bands, border rules and type outside the quiet zone. Resize proportionally. If the design sits on a dark background, keep an opaque light square behind the code so the export preserves its blank margin. Scan the final PDF or image as well as the SVG, because either export can crop or obscure the margin.

If the QR code is part of a sign or package, prepare the logo and illustrations with the [image vectorizer](https://perfectvector.com/image-to-vector) and place the verified QR SVG separately. Use the original vector art whenever the designer can supply it.

## FAQ

### Can I convert a QR code from JPG to SVG?

Yes. Decode the JPG, generate an SVG from the exact decoded content, and read the new SVG again. If the original will not decode, ask the owner for the exact encoded text, the original SVG, or a higher-quality image to scan.

### Why does the rebuilt QR code look different?

An encoder can use a different mask, error-correction level or symbol version for the same content. Compare the decoded string. Ask for the original vector export if you also need the exact visual grid.

### How much white space does a QR code need?

For a standard QR code, leave a clear zone four modules wide on every side. Check the margin on the final export and scan the result at the actual size.

## Sources

1. [DENSO WAVE — Point for determining the code area](https://www.qrcode.com/en/howto/code.html) — module-based sizing and quiet-zone requirements.
2. [Python QR Code project — SVG images](https://github.com/lincolnloop/python-qrcode#svg) — SVG factories and vector paths.
3. [OpenCV — QRCodeDetector class](https://docs.opencv.org/4.x/de/dc3/classcv_1_1QRCodeDetector.html) — the detector used to read the original and regenerated samples.

***

For the artwork around the symbol, [convert your raster artwork with PerfectVector](https://perfectvector.com/image-to-vector). Place the verified QR SVG separately and scan the final layout to confirm that its margin and destination survived.

## Explore

- [Read the HTML article](https://perfectvector.com/blog/qr-code-image-to-svg)
- [Export a PDF Diagram as SVG With PyMuPDF and Keep Paths](https://perfectvector.com/blog/pymupdf-pdf-diagram-to-svg.md)
- [Actual vs Effective PPI: Check the Placed Image](https://perfectvector.com/blog/actual-vs-effective-ppi.md)
- [Product facts](https://perfectvector.com/product-facts.md)
- [FAQ](https://perfectvector.com/faq.md)
- [Pricing and credits](https://perfectvector.com/pricing.md)
