Skip to main content

VietSVG

Vietnamese-safe finishing toolkit for AI-generated SVGs.

Image-to-SVG models (such as Baidu's Unlimited-SVG) can turn a logo, diagram, or infographic into an editable SVG with real <text> nodes. Two things reliably go wrong for Vietnamese content:

  1. The canvas is mostly empty. Some demos shrink the artwork into the middle of a 1024×1024 canvas, so the SVG looks tiny everywhere you use it.
  2. Vietnamese diacritics break. Stacked diacritics (vowel mark + tone: the ằ ầ ề ồ ờ ừ families) are mangled, ê-family tones drift, and characters that never occur in Vietnamese (caron ǎ, ë) show up — we have seen Chiuë and Chéu where the source said Chiêu.

VietSVG finishes those files for real use:

  • Tight auto-crop — computes the true content bounding box (paths, shapes, text, transforms; full-canvas backgrounds ignored) and rewrites the root viewBox. In our verification runs the auto-crop matched a hand crop within 1 unit on a logo (244 244 536 536 vs 244 244 535 535).
  • Diacritic risk scan — lists every <text> node and flags risks by tier: definite (character never occurs in Vietnamese), stacked (vowel mark + tone — check every word), ocr (data-ocr disagrees), digits (verify numbers), review (has Vietnamese diacritics — proofread by eye).
  • Confirmed fixes only — applies a {wrong: right} JSON mapping a human confirmed. VietSVG never guesses text.
  • Optional AI proofreader (Grok or Gemini) — with your own XAI_API_KEY or GEMINI_API_KEY, asks the model to suggest fixes for flagged strings. Suggestions land in a JSON file for you to confirm; nothing is auto-applied.
  • Render proof — optional PNG render so you can eyeball the finished file against the source image.

Quick start

pip install vietsvg
# or from source:
git clone https://github.com/Konoha95/vietsvg && cd vietsvg && pip install -e .

vietsvg check examples/broken-vietnamese.svg
vietsvg finish examples/broken-vietnamese.svg --render
vietsvg finish logo.svg --fix fixes.json --render
XAI_API_KEY=... vietsvg finish logo.svg --grok-proofread
GEMINI_API_KEY=... vietsvg finish logo.svg --gemini-proofread   # GEMINI_MODEL overrides the default model

fixes.json is a plain mapping of confirmed corrections:

{"Chiuë": "Chiêu"}

Why this exists

VietSVG was born from a real workflow in December 2026: converting Vietnamese logos and diagrams with Unlimited-SVG demos, then discovering that every conversion needed the same manual finishing — crop the canvas, hunt broken diacritics word by word, fix, re-render, compare. The first version of this tool caught Xin chao Chiuë automatically and, with one confirmed mapping, produced a clean, correctly cropped Xin chao Chiêu. The full-diacritics test behind the risk tiers is documented in the code: stacked diacritics broke in nearly every instance, single tones and đ mostly held.

Vietnamese is spoken by ~90 million people, and AI design tools keep shipping text that is almost right. Almost-right text in a logo is wrong text. VietSVG is the small, honest finishing step between "the model made an SVG" and "you can ship it".

Built with Grok

This project is developed with Grok Build and uses the Grok API (bring your own key) for its optional proofreader; a Gemini proofreader with the same conservative prompt is available as an alternative backend. The proofreader prompt encodes the same diacritic risk tiers as the scanner, so model suggestions stay conservative: confident errors only, names never guessed.

Web demo

Drop an SVG into the browser demo and see the tight crop plus the diacritic risk report — everything runs locally in your browser, nothing is uploaded: https://konoha95.github.io/vietsvg/ · https://vietsvg.netlify.app/ (source in docs/; the Netlify deployment is powered by Netlify).

Roadmap

  • Web demo: drop an SVG, see the crop + risk report in the browser
  • Side-by-side compare view (source image vs finished SVG render)
  • MCP server + Agent Skill so coding agents can finish SVGs themselves
  • More scripts with stacked diacritics (Thai, Devanagari) via pluggable risk tiers
  • Batch mode for folders of generated assets

Tiếng Việt

VietSVG là công cụ hoàn thiện file SVG do AI tạo ra, chuyên cho nội dung tiếng Việt: tự cắt khung viewBox ôm sát nội dung, quét mọi chữ <text> và cảnh báo chỗ nghi sai dấu (dấu chồng như ằ ầ ề là nhóm rủi ro cao nhất; ký tự ǎ, ë là chắc chắn sai), áp dụng bảng sửa chữ đã được người soát xác nhận — công cụ không tự đoán chữ. Có thể bật thêm bộ soát lỗi bằng Grok hoặc Gemini (dùng API key của bạn) để nhận gợi ý sửa, vẫn phải xác nhận tay trước khi áp dụng.

Contributing

Bug reports with a minimal SVG that crops or flags wrong are gold. See CONTRIBUTING.md. Please follow the Code of Conduct.

License

MIT

Metadata

Release files for vietsvg 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vietsvg 0.2.1
File Size Uploaded Provenance Actions
vietsvg-0.2.1.tar.gz 16.9 kB With provenance Details for vietsvg-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for vietsvg 0.2.1
File Interpreter ABI Platform Actions
vietsvg-0.2.1-py3-none-any.whl Python 3 none any Details for vietsvg-0.2.1-py3-none-any.whl

Total release size: 31.8 kB

Release files / vietsvg-0.2.1.tar.gz

Download URL vietsvg-0.2.1.tar.gz
Size 16.9 kB
Tags Source
SHA-256 checksum
How to use checksums
7834f4d57dddd88866d8203a2201416c69a5f1933dfe57469215ca622ba15e8e
BLAKE2b-256 checksum
How to use checksums
242198cdfbd166945fffc5fc87f55b15ae8c4c0a18b26bafa58a444304048df0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 6, 2026.

Transparency log

Release files / vietsvg-0.2.1-py3-none-any.whl

Download URL vietsvg-0.2.1-py3-none-any.whl
Size 14.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
88356ff27d1b20d9a87998aadaca0b9fb80631057260a8102f8ee7480b8e8647
BLAKE2b-256 checksum
How to use checksums
8654a85e4bf06e5bebe63639597b2a1a86cdece4ff0d67cdfc91ab5f97ec8a3a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 6, 2026.

Transparency log

Security for vietsvg 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for vietsvg-0.2.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 6, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page