Metadata-Version: 2.4
Name: ipolypad
Version: 1.0.2
Summary: Convert an image or SVG into a padded polygon hull for CSS shape-outside / text-wrap.
Project-URL: Homepage, https://github.com/twardoch/ipolypad
Project-URL: Documentation, https://code.twardoch.com/ipolypad/
Project-URL: Repository, https://github.com/twardoch/ipolypad
Project-URL: Issues, https://github.com/twardoch/ipolypad/issues
Author-email: Adam Twardoch <adam+github@twardoch.com>
License-Expression: Apache-2.0
Keywords: image-processing,polygon,potrace,shape-outside,svg,text-wrap
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Multimedia :: Graphics
Classifier: Topic :: Text Processing :: Markup :: HTML
Requires-Python: >=3.10
Requires-Dist: fire>=0.6
Requires-Dist: numpy>=1.24
Requires-Dist: pillow>=10.0
Requires-Dist: potracer>=0.0.4
Requires-Dist: resvg-py>=0.1.5
Requires-Dist: scikit-image>=0.22
Requires-Dist: scipy>=1.10
Provides-Extra: test
Requires-Dist: pytest-cov>=5; extra == 'test'
Requires-Dist: pytest>=8; extra == 'test'
Description-Content-Type: text/markdown

# ipolypad

Convert an image or SVG into a **padded polygon hull** suitable for CSS
`shape-outside` and HTML/canvas text-wrap engines. Reference implementation.

See the project root [`README.md`](../README.md) and [`SPEC.md`](../SPEC.md) for
the full design. This package is the Python side — smart, batteries-included,
multi-format output.

## Install

```bash
uvx ipolypad trace dragon.svg --pad 6 --max-points 32 --out dragon.json
# or
uv pip install ipolypad
```

## CLI

```bash
ipolypad trace <src> [--size 200] [--pad 6] [--max-points 32] \
                     [--hull / --no-hull] [--format json,css,svg,png,html] \
                     [--enhance / --no-enhance] [--bg-tolerance 12] \
                     [--selector .figure] [--out path]

ipolypad batch '*.svg' --out-dir dist/ [trace options...]
```

`src` may be a local path, an `http(s)://` URL, or a `data:` URL.

## Library

```python
from ipolypad import trace

result = trace("dragon.svg", size=200, pad=6, max_points=32, format="json")
print(result["points"])
```

## Output

Default JSON:

```json
{
  "src": "dragon.svg",
  "raster": { "width": 200, "height": 200, "pad": 6 },
  "max_points": 32,
  "n_points": 18,
  "points": [[0.500000, 0.020000], ...]
}
```

`points` are normalized 0..1 against the rasterization box, six decimals,
no trailing closing vertex (polygon is implicitly closed).

## License

Apache-2.0. See [LICENSE](../LICENSE).
