---
title: "Generating Custom Vector QR Codes"
description: "Generate styled SVG and PNG QR codes with embedded center logos and level H error correction."
---

> Documentation Index
> Fetch the complete documentation index at: https://shaf.app/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Generating Custom Vector QR Codes

# Generating Custom Vector QR Codes

Standard black-and-white QR codes break brand aesthetics and degrade when printed on textured packaging. This guide customizes matrix dot geometry, embeds company logos, and exports print-ready vector SVG and high-resolution PNG QR codes backed by level H error correction.

---

## Prerequisites

- Workspace permissions: `Owner`, `Admin`, or `Member` role in your Shaf organization.
- An existing short link created in your workspace.
- A square brand logo (SVG or PNG with transparent background) for center embedding.

---

## Implementation Recipe

1. **Open QR Code Studio**

   In the Shaf Dashboard, navigate to **Links**, locate your short link, and click the **QR Code** action button (⊞). Alternatively, fetch a styled code via the QR generation API (see [Tools API Reference](https://shaf.app/docs/docs/reference/rest-api/tools)):

   ```bash
   curl -X GET "https://shaf.app/api/v1/tools/qr?linkId=lnk_01j8k9m4&format=svg&dots=rounded&color=%231e293b" \
     -H "Authorization: Bearer $SHAF_API_TOKEN" \
     -o "branded-qr.svg"
   ```
2. **Configure Matrix Geometry and Colors**

   Customize styling parameters in the interactive editor:

   ### Dot & Corner Patterns

   Select matrix patterns based on your publication medium:

   | Style | Characteristics | Recommended Usage |
   | :- | :- | :- |
   | `Square` | Sharp, classic edges | Maximum scanner compatibility on low-resolution cameras. |
   | `Rounded` | 25% corner radius on matrix dots | Modern consumer marketing and digital displays. |
   | `Dots` | Fully circular module circles | Event badges, retail merchandise, and lifestyle media. |
   | `Extra-Rounded` | Pill-shaped adjacent modules | Luxury packaging and architectural signage. |

   ### Palette & Contrast

   - **Foreground Color**: Choose a dark brand hex code (e.g., `#0f172a`). Ensure at least a **3:1 contrast ratio** against the background.
   - **Background Color**: Solid white (`#ffffff`) or toggle **Transparent** for overlaying onto colored marketing collateral.

   ### Logo Embedding

   Upload your square brand logo:

   - Shaf centers the logo with automatic white boundary margin padding.
   - Error correction is locked to **Level H (High)**, providing **30% Reed-Solomon data recovery** so the logo never impedes camera scan speed.
3. **Export Vector & Raster Assets**

   Download the finalized asset based on your publication channel:

   - **SVG (Scalable Vector Graphics)**: Infinite scaling with zero pixelation for physical packaging, business cards, and billboards.
   - **PNG (High Resolution 1024x1024 or 2048x2048)**: Optimized for emails, social media graphics, and web presentations.

---

## Verification

Validate scannability using a smartphone camera or the `zbarimg` command-line scanner:

```bash
zbarimg branded-qr.png
```

**Expected output:**
```text
QR-Code:https://shaf.is/summer-deal
scanned 1 barcode symbols from 1 images in 0.04 seconds
```

---

## Common Gotchas

| Issue / Error | Root Cause | Solution |
| :--- | :--- | :--- |
| Camera cannot detect QR code | Contrast ratio between dots and background is less than 3:1. | Use a high-contrast palette (dark dots on light background). |
| Camera reads broken payload | Center logo exceeds 30% of total QR area, corrupting data modules. | Reduce logo dimensions so it covers no more than 20–25% of the central canvas. |
| Pixelated printing on packaging | Bitmap PNG was enlarged for physical offset printing. | Export vector **SVG** format for all physical print production. |
| Inverted colors scan failure | Light dots on dark background scanned by older device cameras. | Keep foreground darker than background for mission-critical print runs. |

Source: https://shaf.app/docs/how-to/link-operations/custom-qr-codes/index.mdx
