cd /news/artificial-intelligence/i-built-a-browser-based-pixel-art-an… Β· home β€Ί topics β€Ί artificial-intelligence β€Ί article
[ARTICLE Β· art-70737] src=dev.to β†— pub= topic=artificial-intelligence verified=true sentiment=↑ positive

I built a browser-based pixel-art & animation editor with Vue, Laravel and AI

A solo developer launched Pixanima, a browser-based pixel-art and animation editor with an optional AI assistant, built with Vue 3 and Laravel 12. The editor is free, with AI features as the only paid component, and uses a post-processing pipeline to convert raw AI output into usable pixel art. The developer also implemented a bulletproof credit system with idempotent transactions and auto-refunds on failure.

read4 min views1 publishedJul 23, 2026

I'm a solo dev, and for the past few months I've been building ** Pixanima** β€” a pixel-art and animation editor that runs entirely in the browser, with an optional AI assistant baked in. It just launched, and I wanted to share the parts that were technically interesting: making a general image model output

Draw pixel art with layers, groups and effects, animate it on a frame timeline with onion-skin, and export to GIF / sprite sheets / PNG β€” all client-side, no install. On top of that, an AI assistant turns a text prompt into sprites, seamless tiles and palettes, re-poses characters, and generates in-between animation frames.

The frontend is Vue 3 driving an HTML canvas; the backend is Laravel 12 (PHP 8.4). Here's what I learned.

The entire editor is client-side. Projects live in IndexedDB; nothing is uploaded. That's great for privacy and speed, but it has a consequence a lot of people miss: you cannot meaningfully gate a client-side feature. If drawing, layers and export all run in the user's browser, any "pro" paywall around them is both unenforceable and, honestly, hostile to a price-sensitive hobbyist community.

So I flipped it: the editor is 100% free, forever. The only paid thing is AI β€” because AI is the only part with a real marginal cost, and it requires a backend (which conveniently also protects the code that costs money to run). More on that below.

The naive approach β€” prompt a diffusion model with "pixel art, 16 colors" β€” gives you pixel-art-ish mush: anti-aliased edges, hundreds of colors, no real grid. Useless as an actual sprite.

The fix is a post-processing pipeline. The model just produces raw input; the "pixel art" is made deterministically afterward with PHP's GD:

1. Generate a normal image from the prompt (flux-schnell on Replicate)
2. Area-downscale to the target grid (e.g. 32Γ—32 cells)
3. Quantize to N colors (imagetruecolortopalette) + optional ordered dithering
4. Key out the background with a tolerant corner flood-fill β†’ transparency

That's the difference between "AI slop" and something you can actually drop onto a canvas and edit. The model is swappable behind an interface, so the same pipeline backs sprites, tiles and palette extraction.

The feature I'm most happy with is AI inbetweening β€” give it two keyframes and it generates the frames between them.

Under the hood it runs Google's FILM frame-interpolation model on the two frame PNGs, gets back an mp4, then ffmpeg splits it into stills. Each interior frame goes through the same pixelization pass (keying out the video's black background), and the results are inserted into the timeline as real, editable frames. For an animation tool, that's a genuine differentiator over "just another sprite editor."

AI costs money per call, so credits need to be bulletproof. Two rules: never double-charge, and never charge for a failure.

The ledger (credit_transactions

) is the source of truth; the balance on the user row is just a synced cache. Every charge is a locked, idempotent transaction:

DB::transaction(function () use ($userId, $cost, $reference) {
    $user = User::whereKey($userId)->lockForUpdate()->first();
    if ($user->credit_balance < $cost) {
        throw new InsufficientCreditsException(); // β†’ HTTP 402
    }
    // idempotent on $reference: a retried webhook or AI call
    // with the same reference never charges twice
    CreditTransaction::firstOrCreate(
        ['reference' => $reference],
        ['user_id' => $userId, 'amount' => -$cost, 'type' => 'spend'],
    );
    // ... update the cached balance
});

The AI endpoint does charge β†’ generate β†’ auto-refund on failure. If Replicate errors or times out, the credits go straight back to the balance. The same idempotency key protects the Stripe webhook that grants credits, so a replayed checkout.session.completed

can't credit an account twice.

Writing the tests for this caught a real bug: credit_balance

isn't mass-assignable (correct, for security), so an update([...])

was silently doing nothing. Tests > vibes.

Devs sometimes flinch at markup, but it's not greed β€” it's the only thing keeping the free editor sustainable. The "they earn β†’ they pay" pressure is captured by a soft commercial-use note, not by crippling features.

It's live and free at ** pixanima.app** β€” no install, projects stay in your browser. I'd genuinely love feedback, especially on the editor feel and the AI features. What would make you actually use it over your current tool?

Happy to go deeper on any part in the comments β€” the canvas rendering, the pixelization math, or the "free tool + paid AI" model.

── more in #artificial-intelligence 4 stories Β· sorted by recency
── more on @pixanima 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain β€” perfect for shipping the agent you just read about.

$git push zahid main
β†’ Live at https://your-agent.zahid.host βœ“
Get free account β†’ Pricing
from €0/mo Β· no card required
LIVE [news/i-built-a-browser-ba…] indexed:0 read:4min 2026-07-23 Β· β€”