Illustrator SVG Import
Hash-verified SVG normalizer that strips Adobe Illustrator private PGF payloads without altering visible geometry.
Single-purpose SVG sanitizer that removes embedded Illustrator private data (aipgf, pgf, foreignObject) and normalizes unambiguous switch nodes while proving visible geometry is SHA-256 identical.
git clone https://github.com/BestRoiMedia/bestroi-game-tools.gitWhy we built it
Adobe Illustrator embeds private PGF data inside exported SVGs and silently reopens that stale payload instead of edited visible SVG paths. Stripping it safely guarantees downstream tools and Illustrator both read the exact visible artwork.
Architecture & how it works
Computes a canonical SHA-256 hash of all visible SVG elements, attributes, and style text before and after removing private PGF/foreignObject branches, refusing to overwrite the source file or proceed if visible structure changes.
Key capabilities
- Strips aipgf, aipgfref, pgf, pgfref, and PGF-only foreignObject elements
- Converts unambiguous single-branch SVG switch elements into standard g groups
- Cryptographic SHA-256 verification guaranteeing zero change to visible geometry or styles
- Immutable source protection (refuses in-place or existing-file overwrites) with JSON receipt output
Usage example
python3 illustrator/svg_import.py ./artwork.svg --out ./artwork.clean.svg --receipt ./receipt.json