Convert PSD file to SVG file
Project description
PSD2SVG
PSD to SVG converter based on psd-tools.
Features
- Convert PSD files to clean, editable SVG
- Preserve layers and artboards with smart group optimization
- Convert text layers to native SVG text elements (experimental)
- Arc warp support with SVG textPath
- Smart font matching with Unicode codepoint-based selection
- Support for most Photoshop blending modes (with approximations for unsupported modes)
- Adjustment layers support (experimental)
- Optional font subsetting and embedding for web optimization (typically 90-95% size reduction)
- Built-in resource limits for security (file size, timeout, layer depth, dimensions)
- Command-line tool and Python API
Installation
pip install psd2svg
Optional Features
# Browser-based rasterization (better SVG 2.0 support)
pip install psd2svg[browser]
playwright install chromium
Quick Start
Command Line
# Basic conversion
psd2svg input.psd output.svg
# With external images
psd2svg input.psd output.svg --image-prefix images/img
Python API
from psd2svg import convert
# Simple conversion with embedded images
convert('input.psd', 'output.svg')
# With external images
convert('input.psd', 'output.svg', image_prefix='images/img')
Advanced Usage
from psd_tools import PSDImage
from psd2svg import SVGDocument
# Load PSD and create SVG document
psdimage = PSDImage.open("input.psd")
document = SVGDocument.from_psd(psdimage)
# Save with options
document.save("output.svg", embed_images=True)
# Embed and subset fonts for web
document.save("output.svg", embed_fonts=True, font_format="woff2")
# Rasterize to PNG
image = document.rasterize()
image.save('output.png')
Known Limitations
- Text rendering: Requires matching system fonts; rendering may differ from Photoshop if fonts are unavailable or substituted
- Text wrapping: Basic support via
--text-wrapping-mode foreignobjectCLI option ortext_wrapping_mode=TextWrappingMode.FOREIGN_OBJECTin Python API (uses<foreignObject>). Note: not supported by ResvgRasterizer, only works in browsers - Blending modes: Some advanced modes approximated due to CSS spec limitations (Dissolve, Linear Burn/Dodge, Darker/Lighter Color, Vivid/Linear/Pin Light, Hard Mix, Subtract, Divide)
- Gradients: Advanced types not supported (Angle, Reflected, Diamond)
- Filter effects: Bevels, embossing, and satin effects not supported; other effects are approximations
- Adjustment layers: Some not yet implemented (Black & White, Channel Mixer, Color Lookup, Gradient Map, Photo Filter, Selective Color, Vibrance)
- Smart objects: Smart object filters not implemented
- Thread safety: APIs are not thread-safe
See the full documentation for complete details and workarounds.
Documentation
Full documentation is available at psd2svg.readthedocs.io
Platform Support
All platforms (Linux, macOS, Windows) are fully supported for text conversion and font embedding. Text layer conversion uses a hybrid approach with built-in font mappings (~4,950 fonts) plus platform-specific font resolution.
For detailed font resolution architecture, platform-specific implementation details, and custom font mapping, see the Font Handling documentation and Technical Notes.
Security
psd2svg includes built-in security features for processing untrusted PSD files:
- Resource limits (file size, timeout, layer depth, dimensions)
- Path traversal protection
- Font file validation
For comprehensive security guidance, sandboxing strategies, and production deployment best practices, see the Security Documentation. To report vulnerabilities, see SECURITY.md.
Development
# Install dependencies
uv sync
# Optional: Install browser support for PlaywrightRasterizer
uv sync --extra browser
uv run playwright install chromium
# Run tests
uv run pytest
# Run type checking and linting
uv run mypy src/ tests/
uv run ruff check src/ tests/
uv run ruff format src/ tests/
See CLAUDE.md for detailed development instructions.
License
MIT License - see LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
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 psd2svg-0.11.0-py3-none-any.whl.
File metadata
- Download URL: psd2svg-0.11.0-py3-none-any.whl
- Upload date:
- Size: 175.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
67353af56d0d7db53252cc2bdd576278079c248309d2b6b4fe8b87fbd5500f2d
|
|
| MD5 |
8cf2eff862b2c5e6fec979ca70149f64
|
|
| BLAKE2b-256 |
2c0d4a726115f4916b3fe5d4a1e7892ad02ffedf0fa018bc4515dd3587c79516
|
Provenance
The following attestation bundles were made for psd2svg-0.11.0-py3-none-any.whl:
Publisher:
release.yml on kyamagu/psd2svg
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
psd2svg-0.11.0-py3-none-any.whl -
Subject digest:
67353af56d0d7db53252cc2bdd576278079c248309d2b6b4fe8b87fbd5500f2d - Sigstore transparency entry: 798163719
- Sigstore integration time:
-
Permalink:
kyamagu/psd2svg@ab18b9a278776fe2bbbd664014459b1fc88b0971 -
Branch / Tag:
refs/tags/v0.11.0 - Owner: https://github.com/kyamagu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ab18b9a278776fe2bbbd664014459b1fc88b0971 -
Trigger Event:
push
-
Statement type: