Metadata-Version: 2.4
Name: eps2svg
Version: 0.1.1
Summary: Convert Adobe Illustrator EPS (LL2) to SVG with native gradients, correct CMYK→RGB and clean clip structure
Author: JUNGHERZ GmbH
License: MIT
Keywords: eps,svg,illustrator,gradient,cmyk,vector
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Multimedia :: Graphics :: Graphics Conversion
Classifier: Topic :: Printing
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: Pillow>=9.0
Dynamic: license-file

# eps2svg

[![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Dependencies: 1](https://img.shields.io/badge/dependencies-1-brightgreen.svg)](https://pypi.org/project/Pillow/)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/JUNGHERZ/eps2svg/pulls)

**Convert Adobe Illustrator EPS files to SVG with real, native gradients — no rasterisation, correct CMYK colours, and clean clip structures.**

`eps2svg` is built for the practical, repeatable task of turning print-ready logo EPS files into future-proof SVG assets for web and app use.

> **Goal:** small, readable SVG code with exact `linearGradient` definitions and colour values you can trust.

[Deutsch / German version](README.de.md)

---

## Why this tool exists

Existing converters like `pstoedit`, `pdf2svg`, or the built-in SVG export from many graphics programs are unreliable precisely where it matters most. The three recurring failure points are:

1. **Clipping masks vs. gradients**  
   Many tools lose the correct nesting order or produce placement errors for masks. `eps2svg` faithfully reproduces the logical hierarchy in SVG.

2. **Gradient stops lie**  
   Adobe generates gradients with flat areas and non-linear ramps (stitching functions). Many converters incorrectly collapse these to just two stops or raster the gradient entirely. `eps2svg` uses a robust reduction (Douglas-Peucker) that respects flat zones and sharp knees.

3. **CMYK→RGB conversion is wrong**  
   Brand colours are often defined in CMYK, but converting them correctly requires colour management. A naive formula distorts them visibly. `eps2svg` asks Ghostscript itself for the conversion, matching what Acrobat and professional tools display.

This was not designed as a universal EPS parser, but as a **practical, predictable tool that gets the common real-world case right**.

## What is supported

- Adobe Illustrator EPS (Language Level 2) converted via Ghostscript PDF output
- Basic vector structures:
  - Paths, fill colours (RGB, Greyscale, CMYK approximation)
  - Native `linearGradient` (direct mapping in SVG)
  - Clipping masks and path clipping
- Bounding box via `HiResBoundingBox` → SVG `viewBox`

## What is not (clearly and honestly)

- **Not a universal EPS solution**: unusual compression schemes, special postscript functions, or printer-specific operations may be outside the supported subset.
- **Radial gradients** are not currently generated.
- Heavily nested transparency effects, font substitution (fonts must be converted to outlines), or complex object patterns are **not** fully supported at this stage.
- The workflow relies on Ghostscript’s PDF conversion as an intermediate step. This is more stable than direct EPS parsing, but it is not infallible.

## Requirements

- Python 3.10+
- Ghostscript (SVG emitter and CMYK colour conversion)
- Optional: `pytest` for running tests

Minimal dependencies are used for the converter itself; the colour conversion falls back to a naive formula if Ghostscript is not available, in which case you will get the approximate CMYK-to-RGB mapping.

## Installation

```bash
pip install eps2svg
```

Or to install locally from the source repository:

```bash
python3 -m venv .venv
source .venv/bin/activate
pip install -e .
```

## Quick start

```bash
eps2svg input.eps output.svg
```

Example:

```bash
eps2svg logo.eps logo.svg
```

Expected results:

- Output contains proper `<linearGradient>` definitions
- Colour values are stable (no flicker between renderers)
- Clip structure is logically layered

## Example (real world)

A typical company logo uses CMYK-defined brand colours with a blended gradient. Instead of flattening to two stops and shifting the colours, `eps2svg` produces clean colour stops, correct masks, and a compact, future-proof SVG.

## Current status

* Small but actively maintained script core.
* Corrected for key pain points: clipping, gradient retention, CMYK colour fidelity.
* The aim is to remain practical and reliable rather than broadly compatible with every possible EPS variant.

## License

MIT – see [LICENSE](LICENSE).

## Contributing

Issues, test cases, and small improvements are very welcome. Good pull requests should include one or more real-world EPS samples to demonstrate the fix and ensure it stays locked in.
