Repository navigation
v0.4.0 — Media transcoding · Postgres backend
What's new in v0.4.0
🎨 Media transcoding (Pillow-backed)
Per-platform image resize for 10 platform specs out of the box: `instagram` (square), `instagram_portrait` (4:5), `instagram_reels` (9:16), `twitter` (16:9), `linkedin` (1200x627), `bluesky`, `telegram`, `threads`, `youtube_thumbnail`, `youtube_short_thumbnail`.
- Honors EXIF orientation (phone photos no longer come out sideways)
- Flattens RGBA/LA/P modes to RGB before JPEG encoding
- Centered aspect crop, no distortion
- Never upscales — quality trumps filling the spec
- LANCZOS resampling, progressive JPEG, optimize=True
REST:
```bash
curl -X POST "http://localhost:8000/media/transcode?platform=twitter" \
-H "Content-Type: image/jpeg" --data-binary @photo.jpg --output photo.twitter.jpg
curl http://localhost:8000/media/specs | jq .twitter
```
Python:
```python
from media import transcode_image
transcode_image("photo.jpg", "instagram") # → photo.instagram.jpg
```
🐘 Postgres queue backend
Opt in via `DATABASE_URL` for true ACID + cross-region multi-worker setups.
- Auto-creates schema on first use (table + partial index on queued rows)
- `mark_publishing` uses conditional UPDATE (`WHERE id = %s AND status = 'queued'`) — two workers in different regions can't double-claim
- `mark_failed` uses `attempts = attempts + 1` directly (no read-modify-write race)
- Factory falls back gracefully: `DATABASE_URL` → Postgres, else `REDIS_URL` → Redis, else JSONL
- `pip install open-dispatch[postgres]` for the optional psycopg2 dep
📜 OSS scaffolding
- `LICENSE` — MIT (matches what we'd advertised since day one)
- `CONTRIBUTING.md` — quick setup, project layout map, step-by-step "add a platform adapter" recipe, code style, commit conventions
Stats
- 129 tests passing (up from 102 in v0.3.0)
- 7 platforms supported, 10 image specs
- 3 queue backends (JSONL / Redis / Postgres) sharing one `QueueProtocol`
- 0 net runtime deps added beyond Pillow (Postgres + Redis remain optional extras)
Coming next
- TikTok adapter (still waiting on Content Posting API approval)
- Video transcoding (ffmpeg-backed, future)
- npm publish for the n8n node