SVGConverter
SVGConverter converts PNG and JPEG images to SVG through a small Python API, command-line interface, and desktop GUI.
Conversion modes
embed(default) places the original raster bytes in an SVG<image>element. It preserves the source pixels, but it is not vectorization and can be larger than the original image because of Base64 encoding.vectorizetraces raster regions into SVG paths using the optional VTracer backend. It is most useful for logos, icons, illustrations, and high-contrast line art. Photographs can produce large, stylized output rather than a faithful smaller image.
Installation
SVGConverter requires Python 3.10 or newer:
python -m pip install --upgrade svgconverter
Install vectorization support when needed:
python -m pip install --upgrade "svgconverter[vectorize]"
To run the current development version instead:
git clone https://github.com/KageRyo/SVGConverter.git
cd SVGConverter
python -m pip install .
Command line
Convert one image, retaining its dimensions in the generated SVG:
svgconverter image.png
svgconverter photo.jpg --output output.svg
svgconverter logo.png --mode vectorize --vectorize-color-mode binary
Convert all supported images immediately inside a directory:
svgconverter ./images --output-dir ./svg-output
Outputs are never overwritten unless --overwrite is supplied. Run
svgconverter --help for all options. Supported inputs are PNG, JPG, and JPEG
(including upper-case extensions); recursive conversion and image optimization
are not part of the current release. Vectorize mode requires the optional
vectorize extra.
Python API
from svgconverter import SVGConverter, convert_file
convert_file("image.png", "image.svg")
convert_file("logo.png", "logo.svg", mode="vectorize")
converter = SVGConverter(overwrite=True)
result = converter.convert_directory("./images", "./svg-output")
print(result.success_count, result.failure_count)
convert_file() returns the output pathlib.Path. Directory conversion returns
a BatchResult containing successful output paths and per-file failures, so a
bad image does not abort the entire batch.
GUI
Install the package and run:
svgconverter-gui
The legacy development command python main.py starts the same GUI. The GUI
currently selects a directory and offers Traditional Chinese, English, and
Japanese. It uses embed mode; vectorize mode is available through the Python
API and CLI.
Contributing and license
See CONTRIBUTING.md for local checks and commit conventions. This project is licensed under the MIT License.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file svgconverter-1.3.0.tar.gz.
File metadata
- Download URL: svgconverter-1.3.0.tar.gz
- Upload date:
- Size: 14.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e4916aaa2d5e254010891f5dbb787e0b27918e384ab11816ae651a9341f3539c
|
|
| MD5 |
9ccdd3e666ba3965878b20e7f88980fe
|
|
| BLAKE2b-256 |
26af94201f34d8e393fa8b766b785246d4fdc5e09a627d1218b5f7de78aa04d2
|
Provenance
The following attestation bundles were made for svgconverter-1.3.0.tar.gz:
Publisher:
release.yml on KageRyo/SVGConverter
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
svgconverter-1.3.0.tar.gz -
Subject digest:
e4916aaa2d5e254010891f5dbb787e0b27918e384ab11816ae651a9341f3539c - Sigstore transparency entry: 2403646656
- Sigstore integration time:
-
Permalink:
KageRyo/SVGConverter@2878a83b55db9779cdb14524c5bd8c487a4eb189 -
Branch / Tag:
refs/tags/v1.3.0 - Owner: https://github.com/KageRyo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2878a83b55db9779cdb14524c5bd8c487a4eb189 -
Trigger Event:
push
-
Statement type:
File details
Details for the file svgconverter-1.3.0-py3-none-any.whl.
File metadata
- Download URL: svgconverter-1.3.0-py3-none-any.whl
- Upload date:
- Size: 12.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7991e162d2809bb2674cbc6fe2c014145ab85b7d68f9e554c2cc090acf9bfce9
|
|
| MD5 |
0cd7b555a7bf4246915e0439e44cea24
|
|
| BLAKE2b-256 |
6878ab2346adbf63c22d8b237e646f1979f123da9645e229e9caf486d747da51
|
Provenance
The following attestation bundles were made for svgconverter-1.3.0-py3-none-any.whl:
Publisher:
release.yml on KageRyo/SVGConverter
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
svgconverter-1.3.0-py3-none-any.whl -
Subject digest:
7991e162d2809bb2674cbc6fe2c014145ab85b7d68f9e554c2cc090acf9bfce9 - Sigstore transparency entry: 2403646766
- Sigstore integration time:
-
Permalink:
KageRyo/SVGConverter@2878a83b55db9779cdb14524c5bd8c487a4eb189 -
Branch / Tag:
refs/tags/v1.3.0 - Owner: https://github.com/KageRyo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2878a83b55db9779cdb14524c5bd8c487a4eb189 -
Trigger Event:
push
-
Statement type: