Image Processing in WebAssembly

Photon is a high-performance image processing library in WebAssembly that runs both natively and on the web.

Features

Photon outperforms even the fastest of libraries, and is powered with Rust, allowing for safe and secure image processing.

  • Web-Assembly Friendly

    For web-based image processing, Photon is 4-10x faster than JS, leading to faster results, and less lag.

    Read More
  • Over 90 functions

    Photon provides functions for every domain of image processing.

    Read More
  • Call WASM with JS

    This library's WASM functions can be called via JS, allowing for zero-cost abstraction and faster development.

    Read More

Features

Run on the web or natively.

Photon can be executed:

  • In the browser via JS
  • Node.JS
  • Natively with Rust

Photon compiles to WebAssembly, which allows the execution of native-speed code in the browser and on Node.JS. This leads to high-performance image processing on the web and since Photon's core library is written in Rust, it promises security and safety.

Photon's core library is a Rust crate, available from Cargo.

Write code in JS without a single line of Rust.

JS code gets exported to WebAssembly.

Performance

Photon outperforms even the fastest of libraries, both natively and on the web.

For full benchmark results, check them out here.

Photon has greatly outperformed ImageMagick and the Python Imaging Library, as shown in the graph to the right, and is on par with libvips.

As for the web, the browser can take advantage of WebAssembly's near-native performance to deliver blazing-fast image processing on the client-side, thus sparing you the need to process images server-side.

Channel/Colour Manipulation

Photon provides low-level access to pixel and channel manipulation, as well as high-level functions for image correction, filtering, watermarking, and convolutions.

Image Resizing

Resize images at lightning-speeds.

High-performance image resizing with 5 different resizing algorithms to choose from, so that you can choose the algorithm most suited to your use case.

Image Correction

Adjust images by correcting brightness, saturation, hues, and more, all within various colour spaces. This gives full flexibility to work in many colour spaces, leading to improved results tailored to your image.

Enhance with Effects

Photon comes with a variety of built-in effects, including:

  • Convolutions: Sobel filters, blurs, Laplace effects, edge detection, etc.,
  • Monochrome effects: Duotoning, greyscaling of various forms, thresholding, sepia, averaging RGB values
  • Filters: Over 30 pre-set filters available, incorporating various effects and transformations.

Blend Images

Functions include:

Blending:

Blend images together using 10 different techniques.

Create new images from existing ones, or create new worlds from source images.

View The Demo

To see WebAssembly in action and all effects available, make sure to check out our demo , where you can test out the effects, view performance, and see if Photon is the right library for your website.

Get Started In Just 3 Lines of Code

You can transform an image in just 3 lines of code, either in JS or Rust, whichever your choice may be.

Compare WebAssembly versus JavaScript

To compare JavaScript vs WebAssembly, click on one of the buttons below to see the right-hand side image edited by either JavaScript or WebAssembly.

The time taken to edit the image will be displayed below.

JS time:

WASM time: