Photon: Rust/WebAssembly Image Processing Library for Native, Browser, and Node
⚡ Rust/WebAssembly image processing library
At a glance
- What is it?
- Photon is a Rust image processing library that compiles to WebAssembly, letting you run the same 96-function image manipulation API natively in Rust, in any WASM-capable browser, and in Node.js. The Apache-2.0 license and pre-built npm packages lower the cost of adoption, but the library has no GitHub releases and the current published version is 0.3.2.
- Who is it for?
- Photon is the right choice when you need image processing that runs in the browser or in Cloudflare Workers without a native extension. Its 96 functions cover most common transformations, and the separate npm packages for web and Node keep the integration surface small.
- Can I use it commercially?
- Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 13 days ago.
- What is it written in?
- Mainly Rust, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on September 30, 2026, and from our analysis. They are not legal advice.
Editorial analysis
Image Processing That Works in a Browser Without a Server Round-Trip
Most image processing libraries for the web require a server: the browser sends an image, a backend process (using ImageMagick, PIL, or sharp) transforms it, and the result comes back. Photon breaks that dependency. Because it compiles to WebAssembly, the image processing runs inside the browser itself. The user's machine does the work, there is no round-trip, and the server never sees the image data.
This makes Photon relevant for two categories of use:
First, client-side image tools: photo editors, filter previews, crop and resize interfaces, and watermarking tools where running code in the browser is a privacy or performance requirement.
Second, server-side contexts where native binaries are unavailable or undesirable: Cloudflare Workers, edge compute environments, and Node.js setups that cannot install native extensions. The README documents separate npm packages for each of these targets.
The library is written entirely in Rust, giving it memory safety guarantees without a garbage collector. The Apache-2.0 license allows use in both open-source and proprietary projects without copyleft obligations.
Three Deployment Targets: Native Rust, Browser WASM, and Node.js
Photon provides three distinct distribution packages, each targeting a different runtime:
Native Rust is the base. The crate photon-rs on Crates.io gives you direct Rust API access. This is the fastest option and the right one for command-line tools, desktop applications, or backend services written in Rust.
Browser WebAssembly uses the package @silvia-odwyer/photon on npm. It runs in any browser that supports WebAssembly: the README lists Chrome, Firefox, Safari, and Edge. This target requires a bundler like Webpack when used in a standard web project.
Node.js uses a separate package, @silvia-odwyer/photon-node, also on npm. The README links to a Node.js tutorial that shows how to load and use the WASM module in a server-side context.
For Cloudflare Workers there is a third-party package, @cf-wasm/photon, documented at npmjs.com. The README notes its existence and links to the full usage steps, though this package is maintained outside the main repository.
Building the WebAssembly package yourself requires wasm-pack:
wasm-pack build ./crateThe README links to the wasm-pack installation guide for setup instructions.
Installing and Using Photon Natively in a Rust Project
Add the crate to your Cargo.toml:
[dependencies]
photon-rs = "0.3.2"The following example opens an image from the filesystem, alters the red channel, and saves the result:
extern crate photon_rs;
use photon_rs::native::{open_image, save_image};
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Open the image (a PhotonImage is returned)
let mut img = open_image("test_image.PNG")?;
// Increment the red channel by 40
photon_rs::channels::alter_red_channel(&mut img, 40);
// Write file to filesystem.
save_image(img, "raw_image.JPG")?;
Ok(())
}open_image returns a PhotonImage struct. Functions like alter_red_channel take a mutable reference to the PhotonImage and modify it in place. save_image writes the result back to disk. The README notes that the exact format of the output file (PNG, JPEG, etc.) is determined by the extension you specify.
Installing Photon for Browser or Node.js Projects
For a project using Webpack or another bundler that targets the browser:
npm install @silvia-odwyer/photonFor a Node.js server-side project:
npm install @silvia-odwyer/photon-nodeBoth packages give you the same 96-function API over WASM. The browser build requires the hosting environment to support WebAssembly, which all current major browsers do. The Node.js build requires loading the WASM module before calling any Photon functions; the linked tutorial on the official guide documents the initialization step.
For Cloudflare Workers the third-party package installs separately:
npm install @cf-wasm/photonThe README points to the @cf-wasm/photon package page for full usage steps. Since this package is not part of the main repository, its versioning and maintenance are independent of the main Photon project.
What the 96 Functions Cover: Modules and Capabilities
The 96 functions are organized into modules. The README lists the following categories:
Image correction covers hue rotation, sharpening, brightness adjustment, saturation adjustment, and lightening and darkening across multiple colour spaces.
Resizing and transform cover image resize, crop, rotate, and flip, both natively and in WASM.
Convolutions include Sobel filters, blurs, Laplace effects, and edge detection.
Channel manipulation covers increasing and decreasing RGB channel values, swapping channels, and removing channels.
Monochrome effects include greyscaling in various forms, thresholding, sepia, and averaging RGB values.
Colour manipulation lets you work in HSL, LCh, and sRGB colour spaces to adjust colours.
Filters provide over 30 preset effects combining multiple transformations.
Watermarking supports adding watermarks in multiple formats.
Blending provides 10 techniques for compositing images together and changing image backgrounds.
Special effects include film grain, vignette, and Bayer dither effects. The README notes that these are in the repository but will be published to npm and Crates.io in the next release in 2026, meaning they are not available in the current v0.3.2 package.
Version 0.3.2 added a duotone filter, preset duotone effects, image rotation, a dithering filter, and a fix for image cropping.
Where Photon Falls Short: WASM Overhead and Missing Release Tags
Photon has two concrete limitations that affect the adoption decision.
First, WASM adds overhead relative to native code. When running Photon through the Node.js WASM package, there is serialization cost to pass image data in and out of the WASM module boundary. For high-throughput server-side image processing of large images, this overhead can matter. The README links to benchmarks on the project wiki but does not summarize the numbers in the README text itself.
Second, the repository has no GitHub releases. The current version is 0.3.2 on Crates.io and npm, and the repository shows a last push on 2026-09-18, but there are no GitHub release tags. This makes it harder to track what changed between versions without reading git history directly. The CHANGELOG.md file in the repository documents changes, but the release workflow does not use GitHub Releases.
Some functionality (special effects module items) is in the repository but not yet in the published packages. Code that uses the GitHub source directly will behave differently from code that uses the published npm or Crates.io versions.
Photon vs Sharp: Browser Portability Against Native Binding Speed
Sharp is a Node.js image processing library that wraps libvips through a native binding. It is a server-side-only tool: it does not compile to WebAssembly and cannot run in a browser. Sharp's native binding to libvips makes it fast for server-side batch processing.
Photon's defining advantage over sharp is portability: the same library works in the browser and in Node.js using the same API. If your use case requires in-browser image processing, sharp is not an option; Photon is. If you are building a Cloudflare Worker or an edge function where native binaries cannot be installed, Photon's WASM build fits where sharp does not.
For a pure Node.js backend where native bindings are available and throughput is the priority, sharp's libvips-based pipeline is faster than Photon's WASM approach for large images. The right choice depends on whether browser or edge compatibility is a requirement. When it is, Photon has no direct equivalent in the Node.js ecosystem.
Editorial conclusion
Photon is the right choice when you need image processing that runs in the browser or in Cloudflare Workers without a native extension. Its 96 functions cover most common transformations, and the separate npm packages for web and Node keep the integration surface small. It is the wrong choice when raw throughput on large batches matters most: native Rust is fast, but running Photon through WASM in Node.js is slower than a native binding to a library like libvips, which is what sharp uses. Before adopting Photon for a Node.js backend, check whether the WASM overhead fits your latency budget. The current published release is 0.3.2; some special effects listed in the repository are not yet published to npm or Crates.io.
Frequently asked questions
How does Photon run in a web browser?
Photon compiles to WebAssembly and is distributed as the npm package @silvia-odwyer/photon. Any browser that supports WebAssembly (Chrome, Firefox, Safari, and Edge) can load and execute it. A live demo is available at silvia-odwyer.github.io/photon/demo.html.
What image formats does Photon support?
The README lists PNG, JPEG, BMP, ICO, TIFF, and WEBP as the supported input and output formats.
Can Photon be used with Cloudflare Workers?
Yes, through the third-party package @cf-wasm/photon, which the README links to and which is documented at npmjs.com/package/@cf-wasm/photon. This package is maintained separately from the main Photon repository.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/silvia-odwyer-photon)