Metadata-Version: 2.4
Name: xnano-image
Version: 0.2.0
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
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: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Rust
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: MacOS
Classifier: Typing :: Typed
License-File: LICENSE
Summary: Image & animation loading, processing & display support for the xnano terminal library.
Home-Page: https://github.com/hsaeed3/xnano
Author-email: Hammad Saeed <hammad@supportvectors.com>
License-Expression: MIT
Requires-Python: >=3.10
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Documentation, https://xnano.dev
Project-URL: Homepage, https://github.com/hsaeed3/xnano
Project-URL: Source, https://github.com/hsaeed3/xnano

# xnano-image

Load, process and convert images and animations to terminal cells without external libraries.

## Install

```bash
pip install xnano-image
```

Or install as an extra of the top-level `xnano` package:

```bash
pip install "xnano[image]"
```

## Example

```python
from xnano_image import TerminalImage, TerminalGraphics

# Create an image from raw RGBA bytes
width, height = 2, 2
pixels = bytes([255, 0, 0, 255] * (width * height))  # Red pixels
image = TerminalImage.from_rgba(width, height, pixels)

# Convert to terminal cells (half-block characters by default)
grid = image.to_cell_grid(columns=10, rows=5)

# Or load from a file: image = TerminalImage.open('photo.png')
# Half blocks work in every terminal; TerminalGraphics.detect() asks for sixel, kitty or iterm2
graphics = TerminalGraphics.half_blocks()
```

## What it provides

- **Image loading**: PNG, JPEG, GIF, WebP and the compact XNI1 container format
- **Processing**: resize, crop, scale, fit, quantize, flatten transparency and retime animations
- **Conversion**: to terminal cell grids (text) or animations with frame timing, with half-blocks or native graphics protocols
- **No external tools**: decoding and processing are built in
- **Graphics detection**: query terminal capabilities for sixel, Kitty or iTerm2 support

## Links

- **Repository**: https://github.com/hsaeed3/xnano
- **Documentation**: https://xnano.hammad.app
- **API reference**: https://xnano.hammad.app/api-reference/
- **License**: MIT

