Metadata-Version: 2.4
Name: purepix
Version: 0.1.0
Summary: Pure-Python, zero-dependency image library: codecs (PNG/JPEG/GIF/BMP/...), processing, drawing, QR/barcodes, and generative art — all from scratch
Author: Equinox
License: MIT
Keywords: image,png,jpeg,gif,codec,graphics,drawing,qr,fractal,pure-python,zero-dependency
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Multimedia :: Graphics
Classifier: Topic :: Multimedia :: Graphics :: Graphics Conversion
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# purepix

A **pure-Python, zero-dependency** image library — codecs, processing,
drawing, and a pile of generative art, all implemented from scratch on top of
the standard library. No NumPy, no Pillow, no C extensions.

```python
import purepix
img = purepix.open("photo.jpg")          # auto-detected by magic bytes
small = img.resize((320, 240), purepix.BILINEAR)
purepix.save(small.filter(purepix.filters.SHARPEN), "out.png")
```

## Install

```bash
pip install purepix
```

Requires Python 3.10+. Zero runtime dependencies.

## What's inside

**Image formats** (read/write unless noted)
- BMP, PNG (1/2/4/8/16-bit, Adam7 interlace, tRNS, lossless 16-bit),
  GIF (incl. animated), PNM (PPM/PGM), TGA (RLE), ICO, farbfeld, WBMP, PCX, XPM
- JPEG — baseline **and** progressive decode + baseline encode
- Compression written from scratch: DEFLATE (dynamic Huffman) and GIF LZW

**Core image ops** (`Image`)
- 8-bit and 16-bit depth, mode conversion, crop, paste, split/merge channels
- resize (nearest / bilinear), flip, rotate (90° and arbitrary angle), affine
- point LUTs, convolution `filter`

**Processing**
- `filters` — blur / gaussian / sharpen / unsharp / median / edge / sobel /
  emboss, brightness / contrast / gamma / invert / threshold / posterize /
  solarize, histogram / equalize / autocontrast, ordered dithering
- `color` — RGB↔HSV, hue/saturation/value, sepia
- `composite` — blend modes, alpha compositing, linear/radial gradients
- `quantize` — median-cut + Floyd–Steinberg dithering
- `morphology` — erode/dilate/open/close, connected components
- `effects` — pixelate, vignette, motion blur, cartoon, glitch, oil paint
- `seam` — content-aware resize (seam carving)
- `compare` — aHash/dHash/pHash, PSNR, SSIM

**Drawing** (`Draw`)
- point, line, wide/anti-aliased line, rectangle, rounded rectangle, ellipse,
  arc, polygon (scanline fill), flood fill, and text via a built-in bitmap font

**Tools**
- `qr` — QR code generator (Reed–Solomon, masking, format info)
- `barcode` — Code 128 and EAN-13
- `stego` — LSB steganography
- `exif` — JPEG EXIF / PNG text metadata, auto-orient
- `dft` — 2-D DFT: spectrum + low/high-pass filtering
- `ascii_art` — render images to ASCII / ANSI

**Generative art & simulation**
- `fractal` (Mandelbrot/Julia), `noise` (Perlin/fBm, clouds, marble),
  `lsystem`, `reaction` (Gray-Scott), `automata` (Life + elementary CA),
  `maze`, `wfc`, `raytrace`, `plasma`/fire, `dla`, `voronoi`/stippling,
  `flowfield`, `sortviz`, `astar`

## Command line

```bash
python -m purepix info photo.png
python -m purepix convert in.png out.jpg --quality 90
python -m purepix resize in.png out.png --size 320x240
python -m purepix qr "https://example.com" qr.png
python -m purepix hash photo.png --type phash
```

## Example

```python
import purepix
from purepix import Draw, fractal, qr

# generate a fractal
fractal.mandelbrot((400, 300), max_iter=150).save("mandelbrot.png")

# draw with the built-in font
img = purepix.Image.new("RGB", (200, 60), (20, 20, 30))
Draw(img).text((10, 20), "PUREPIX", (0, 255, 180), scale=3)
img.save("banner.png")

# make a QR code
qr.encode("hello world", ec="M").save("qr.png")
```

## License

MIT © Equinox
