Three tools — background removal, upscaling, and expansion — served straight from Cloudflare's edge. No signup, no watermarks, no upsells.
Drop a photo, click Remove background. A subject-aware model returns a clean PNG with the background cut out — preserving fur, hair, and soft edges.
Details
- Powered by
bria/remove-backgroundon Replicate - Outputs 1024×1024 PNG with full alpha
- ~2–3 seconds per run
preserve_alpha: truekeeps soft edges crisp
Two profiles for two needs. Fast stays faithful to the original; Quality adds plausible detail to recover over-smoothed features.
Details
- Powered by
philz1337x/clarity-pro-upscaler - Fast =
creativity: 0(no invention) - Quality =
creativity: 4(detail enhancement) - 2× or 4× output from any input resolution
Outpaint your image to any aspect ratio. Link width and height for proportional expansion, or unlock for custom dimensions.
Details
- Powered by
bria/expand-image - Generates 1024×1024 at the target aspect with the subject preserved
- Linked W/H input or click the chain to unlock
Pictune is a single self-contained Cloudflare Worker. The whole stack — UI,
runtime, rate limiting, analytics, and bot defense — ships in one
wrangler deploy.
- Edge-only. No origin server. No cold starts above the first request.
- Bot-resistant by default. Every transformation goes through Cloudflare Turnstile.
- Self-throttling. Per-IP rate limiter (100/hour, sliding window) backed by a Durable Object.
- Observable. Admin dashboard at
/adminbreaks down usage by tool, country, and outcome — including bot-blocked attempts.
Tech stack
| Layer | Tech |
|---|---|
| UI | React 19 · Vite · Tailwind v4 · TypeScript · lucide-react |
| Runtime | Cloudflare Workers |
| Storage | Durable Objects (SQLite-backed) — rate limiting + analytics |
| AI | Replicate — bria/remove-background, philz1337x/clarity-pro-upscaler, bria/expand-image |
| Bot defense | Cloudflare Turnstile |
Self-hosting
You'll need:
- A Cloudflare account
- A Replicate API token
- A Cloudflare Turnstile sitekey + secret from the Cloudflare dashboard
git clone https://github.com/your-name/pictune
cd pictune
npm install
# Fill in REPLICATE_API_TOKEN, ADMIN_PASSPHRASE,
# TURNSTILE_SECRET_KEY, VITE_TURNSTILE_SITE_KEY
cp .env.example .env
$EDITOR .env
npm run dev # local development
npm run deploy # ship to CloudflareIn dev, Pictune auto-swaps to Cloudflare's
Turnstile test keys
when serving localhost, so you don't need to whitelist your dev hostname in
the Turnstile dashboard.
Architecture
Browser ─────────────────► Cloudflare Worker
│ cf-turnstile-response │
│ ├─ verifyTurnstile → challenges.cloudflare.com
│ ├─ RateLimiter DO (per IP, sliding window)
│ ├─ Analytics DO (global event log)
│ └─ POST → Replicate → poll → done
│ │
└─◄──────────────── PNG bytes ◄───────────────────────────────┘
The Worker proxies binary bytes back to the client — Replicate URLs and tokens never leave the edge. Polling, output streaming, and cancel are intentionally not Turnstile-gated, so long-running jobs don't die when a token ages out.
Scripts
| Command | What it does |
|---|---|
npm run dev |
Local development (Vite + miniflare) |
npm run check |
TypeScript check |
npm run build |
Production build |
npm run deploy |
Build + wrangler deploy |
npm run types |
Regenerate Worker binding types from wrangler.jsonc |
Made with by Confidence
