Back to articles
How I Built a Browser Image Converter That Processes Files in Parallel

How I Built a Browser Image Converter That Processes Files in Parallel

via Dev.to WebdevEneko Martínez de Morentin Fusco

I got tired of online image converters that upload my files to a server just to change a PNG to a JPG. Every single one of them sends your images to some remote machine, processes them there, and sends them back. That means your files sit on someone else's server, the conversion depends on your upload speed, and batch converting 50 images takes forever. So I built Pixformat , a free image converter that runs entirely in the browser. No uploads, no servers, no waiting. Your files never leave your device. But making it fast was the real challenge. Converting a single image on the main thread is straightforward. Converting 50 images without freezing the UI required a completely different architecture. Here is how I solved it. The Problem with Main Thread Conversion The basic approach to client side image conversion in JavaScript looks like this: function convertImage ( file , format ) { return new Promise ( resolve => { const img = new Image (); img . onload = () => { const canvas = docum

Continue reading on Dev.to Webdev

Opens in a new tab

Read Full Article
2 views

Related Articles