Keeping a Side Project at $0/mo by Moving Image Processing to HTML5 Canvas
When you run a small utility site on free hosting tiers, the fastest way to blow through your bandwidth and serverless execution limits is letting users upload images to your backend. βWhile building a small web utility
When you run a small utility site on free hosting tiers, the fastest way to blow through your bandwidth and serverless execution limits is letting users upload images to your backend.
βWhile building a small web utility (kikpin.me) in plain Node.js, I wanted to add a few creator toolsβan image resizer for specific aspect ratios and a dominant color palette extractor. The obvious route was spinning up an API endpoint with sharp or a third-party image service. The problem: even modest traffic would quickly eat through free-tier RAM and function timeouts.
βSo I moved all of it to the browser using plain HTML5 Canvas and vanilla JavaScript. Here is what actually worked, and a few edge cases that tripped me up.Lesson learned: Always call URL.revokeObjectURL(url) once the image loads. On mobile browsers, forgetting to revoke object URLs when users test multiple large photos in a row will noticeably spike memory usage.
β2. Extracting Dominant Colors Without Heavy Libraries
βFor the color palette tool, I didn't want to ship a huge npm package just to grab 5 HEX codes. Drawing the uploaded image onto a tiny 50Γ50 canvas first solves two problems at once:
βIt shrinks a 4000Γ3000 photo down to just 2,500 pixels, so ctx.getImageData() runs in a few milliseconds.
βIt naturally smooths out noise.
βFrom there, looping through the RGBA array, quantizing each channel (rounding to the nearest multiple of 24 or 32), and counting the most frequent buckets gives a surprisingly accurate 5-color palette with zero external dependencies.
β3. The SEO Gotcha With Adding New Routes
βThe technical part of building the tools took a weekend. The annoying part was getting Google to index them cleanly alongside multilingual routes (/ plus 7β8 language subpaths).
βA few things I had to fix after watching Google Search Console:
βSelf-referencing canonicals on every locale: If /vi or /pt accidentally inherits the root canonical (/), Google drops the translated page as an "Alternative page with proper canonical tag."
βDon't expect instant indexing for hub pages: A /tools index page that is mostly cards and links often sits in "Crawled - currently not indexed" longer than standalone pages with actual instructions and text.
βFavicon sizing: Google ignores favicons that aren't a multiple of 48x48 (like 48px, 96px, 192px) and falls back to a generic globe icon in search results.
βWrapping Up
βMoving compute to the client isn't always possible, especially when you need to hide API keys or scrape/resolve external URLs. But for anything involving image manipulation, color sampling, or text formatting, keeping it 100% client-side means instant feedback for the user, better privacy (their files never leave their device), and a $0 server bill.
βHas anyone else here hit mobile Canvas memory limits with large WebP/PNG exports? Curious how you handle downscaling on older Android devices without crashing the tab.
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.