Skip to content

Calvin-LLC/illustrator-exporter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ai-exporter

Parse and export Adobe Illustrator .ai files to SVG, PNG, and JSON all from cli without Illustrator installed. Also supports rebuilding .ai files from edited SVGs with CMYK/spot color preservation.

What it does

  • Extracts vector artwork from .ai files (PDF-wrapped, EPS, or raw PostScript)
  • Exports to SVG, PNG, or JSON
  • Inspects .ai file structure and metadata
  • Rebuilds .ai files from SVG edits, preserving CMYK and spot colors via a metadata sidecar
  • Handles AI9 through AI24+ formats, including Zstandard and zlib compression

Why not just use Inkscape / Ghostscript / pdftocairo?

Most "convert .ai to SVG" tools just treat the .ai as a PDF and run it through a PDF-to-SVG converter. That's fine if you only need the shapes on the page. You lose the layers, the CMYK values, the spot colors, and any way to save it back as a real .ai.

ai-exporter Inkscape CLI Ghostscript / pdftocairo Adobe Illustrator scripting
No Illustrator license required yes yes yes no
No external binary required yes no no no
Parses native PGF PostScript yes no (PDF only) no (PDF only) yes
Preserves CMYK color values yes no (RGB) no (RGB) yes
Preserves spot colors yes no no yes
Handles AI24+ Zstandard streams yes no no yes
Round-trip: SVG → .ai yes no no yes
License MIT GPL AGPL / commercial proprietary

The reverse path is the main reason this exists. Open the SVG wherever you like, change colors or paths, and rebuild the .ai with the CMYK and spot-color values intact. That works because the extractor drops a .ai-meta.json sidecar next to the SVG holding the color info SVG itself can't store.

Setup

Requires Python 3.10+.

# 1. Create and activate a virtual environment
python -m venv .venv

# macOS / Linux
source .venv/bin/activate

# Windows (cmd)
.venv\Scripts\activate

# 2. Install the package (editable, with dev deps)
pip install -e ".[dev]"

# 3. (Optional) Copy the env template for batch scripts
cp .env.example .env        # macOS / Linux
copy .env.example .env      # Windows

# 4. Verify everything is wired up
ai-export check

After install, the CLI is available as ai-export (or python -m ai_exporter.cli).

Environment variables

Set these in .env (optional — only needed if you use the batch scripts under scripts/):

# Directory containing folders of .ai files to batch-process
AI_EXPORTER_SOURCE_DIR=/path/to/ai/files

# Directory of .ai files used by integration tests
AI_EXPORTER_TEST_DIR=/path/to/test/ai/files

Usage

# Export to SVG
ai-export extract design.ai --format svg --output-dir ./output

# Export to PNG
ai-export extract design.ai --format png --output-dir ./output

# Export to JSON
ai-export extract design.ai --format json --output-dir ./output

# Inspect file structure
ai-export inspect design.ai

# Rebuild .ai from edited SVG (uses metadata sidecar for color fidelity)
ai-export rebuild edited.svg --original design.ai --output rebuilt.ai

# Verify dependencies are installed
ai-export check

# Tests @ `tests/_artifacts/`
python -m pytest