Image processing in Cloudflare Workers
Learn how to use Cloudflare Workers at the edge for efficient image processing and optimization, boosting performance with serverless solutions.
Learn how to use Cloudflare Workers at the edge for efficient image processing and optimization, boosting performance with serverless solutions. I was looking for an alternative to Sharp since it does not work on Cloudflare Workers as it uses Node.js APIs, which are not yet supported in Cloudflare's workerd runtime. Then I came across Photon , a high-performance Rust image processing library, which compiles to WebAssembly. Photon offers a variety of functions for resizing, transforming, watermarking, and more. There is official npm package available for it, but it was not working with Wrangler when I tried it last time, and also it was missing some new functions. Therefore, I forked the repository and compiled it to WebAssembly using wasm-pack to make it compatible with Cloudflare Workers. I have also published it as npm package @cf-wasm/photon . Implementation You can use this package in an existing workers project or create a new project by running: npm create cloudflare@latest -- cf-w…