Metadata-Version: 2.4
Name: bh_pixelfuse
Version: 0.0.5
Summary: Embed images into portable text files and extract them back
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Requires-Dist: fastapi>=0.115.0
Requires-Dist: uvicorn[standard]>=0.31.0
Requires-Dist: Pillow>=10.0.0
Requires-Dist: python-multipart>=0.0.12
Requires-Dist: pydantic>=2.9.0
Requires-Dist: pydantic-settings>=2.6.0
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.24; extra == "dev"
Requires-Dist: httpx>=0.27; extra == "dev"
Requires-Dist: flake8>=7.0; extra == "dev"
Requires-Dist: mypy>=1.11; extra == "dev"
Requires-Dist: tox>=4.0; extra == "dev"

# PixelFuse Backend

FastAPI service that embeds images into portable text files and extracts them back.

## Docs

| # | File | Description |
|---|------|-------------|
| 001 | [Overview](docs/001_overview.md) | What PixelFuse does and the text file format |
| 002 | [API Reference](docs/002_api.md) | Endpoint contracts, fields, and error codes |
| 003 | [Configuration](docs/003_configuration.md) | Env vars and CLI flags |
| 004 | [Development](docs/004_development.md) | Local setup, tests, lint, Docker |
| 005 | [Deployment](docs/005_deployment.md) | Render, CI, self-hosted Docker |

## Endpoints

| Method | Path | Description |
|--------|------|-------------|
| POST | `/convert-embed/` | Upload images → download base64 text file |
| POST | `/extract-images/` | Upload text file → download ZIP of images |

Supports JPEG, PNG, and HEIC formats. Max 10 files per request (configurable).

**No distortion.** Embed → extract is lossless. Raw image bytes are base64-encoded and decoded back exactly — no re-encoding at any stage.

## Quickstart

```bash
pip install -e ".[dev]"
pixelfuse serve --reload
```

## Configuration

All settings are overridable via environment variables prefixed `PIXELFUSE_`:

| Variable | Default | Description |
|----------|---------|-------------|
| `PIXELFUSE_HOST` | `0.0.0.0` | Bind host |
| `PIXELFUSE_PORT` | `8000` | Bind port |
| `PIXELFUSE_LOG_LEVEL` | `info` | Uvicorn log level |
| `PIXELFUSE_MAX_UPLOAD_FILES` | `10` | Max files per request |
| `PIXELFUSE_RATE_LIMIT_PER_MINUTE` | `60` | Max requests per minute per IP (0 = disabled) |
| `PIXELFUSE_ALLOWED_ORIGINS` | *(required)* | CORS origins (JSON array) |

Copy `.env.example` to `.env` for local overrides.

## Development

```bash
# Lint
flake8 src tests

# Type check
mypy src

# All environments
tox
```

## Deployment

Deployed on [Render](https://render.com) via `render.yaml`. CI runs on every push via GitHub Actions.
