Metadata-Version: 2.4
Name: pictex
Version: 0.2.0
Summary: A library to generate stylized text images.
Project-URL: Homepage, https://github.com/francozanardi/pictex
Project-URL: Repository, https://github.com/francozanardi/pictex
Author-email: Franco Zanardi <francozanardi97@gmail.com>
License-File: LICENSE
Keywords: graphics,image-generation,skia,text-rendering,text-to-image,typography
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Multimedia :: Graphics
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Text Processing :: Fonts
Classifier: Typing :: Typed
Requires-Python: >=3.9
Requires-Dist: skia-python
Provides-Extra: test
Requires-Dist: pillow; extra == 'test'
Requires-Dist: pytest; extra == 'test'
Requires-Dist: pytest-regressions; extra == 'test'
Description-Content-Type: text/markdown

# PicTex

[![PyPI version](https://badge.fury.io/py/pictex.svg)](https://badge.fury.io/py/pictex)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

A powerful Python library to create beautifully styled text images with a simple, fluent API. Powered by Skia.

![PicTex](https://raw.githubusercontent.com/francozanardi/pictex/main/docs/assets/readme-1.png)

**`PicTex`** makes it easy to generate styled text images for social media, video overlays, digital art, or any application where stylized text is needed. It abstracts away the complexity of graphics libraries, offering a declarative and chainable interface inspired by CSS.

## Features

-   **Fluent & Reusable API**: Build styles declaratively and reuse them.
-   **Rich Styling**: Gradients, multiple shadows, outlines, and text decorations.
-   **Advanced Typography**: Custom fonts, variable fonts, line height, and alignment.
-   **Automatic Font Fallback**: Seamlessly render emojis and special characters even if your main font doesn't support them.
-   **Flexible Output**: Save as PNG, or convert to NumPy arrays or Pillow images with ease.
-   **High-Quality Rendering**: Powered by Google's Skia graphics engine.

## Installation

```bash
pip install pictex
```

## Quickstart

Creating a stylized text image is as simple as building a `Canvas` and calling `.render()`.

```python
from pictex import Canvas

# 1. Create a style template using the fluent API
canvas = (
    Canvas()
    .font_family("path/to/font.ttf")
    .font_size(60)
    .color("white")
    .padding(20)
    .background_color(LinearGradient(["#2C3E50", "#FD746C"]))
    .background_radius(10)
    .add_shadow(offset=(2, 2), blur_radius=3, color="black")
)

# 2. Render some text using the template
image = canvas.render("Hello, PicTex! 🎨✨")

# 3. Save or show the result
image.save("hello.png")

```

![Quickstart result](https://raw.githubusercontent.com/francozanardi/pictex/main/docs/assets/readme-2.png)

## 📚 Dive Deeper

For a complete guide on all features, including text decorations, advanced gradients, smart cropping, and more, check out our full documentation:

-   [**Getting Started & Core Concepts**](docs/getting_started.md)
-   [**Styling Guide: Colors & Gradients**](docs/colors.md)
-   [**Styling Guide: Text & Fonts**](docs/text.md)
-   [**Styling Guide: Containers & Effects**](docs/effects.md)
-   API Reference (coming soon)

## Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the [issues page](https://github.com/francozanardi/pictex/issues).

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
