All Projects → silvia-odwyer → Photon

silvia-odwyer / Photon

Licence: apache-2.0
⚡ Rust/WebAssembly image processing library

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Photon

Ant Design Blazor
🌈A set of enterprise-class UI components based on Ant Design and Blazor WebAssembly.
Stars: ✭ 3,890 (+303.95%)
Mutual labels:  hacktoberfest, webassembly, wasm
Smartcircle
✂️Automatically determine where to crop a circular image out of a rectangular.
Stars: ✭ 29 (-96.99%)
Mutual labels:  image-processing, webassembly, wasm
Wasm Imagemagick
Webassembly compilation of https://github.com/ImageMagick/ImageMagick & samples
Stars: ✭ 442 (-54.1%)
Mutual labels:  image-processing, image-manipulation, webassembly
Uno.ch9
Ch9 - Uno Reference Implementation project
Stars: ✭ 45 (-95.33%)
Mutual labels:  hacktoberfest, webassembly, wasm
Uno
Build Mobile, Desktop and WebAssembly apps with C# and XAML. Today. Open source and professionally supported.
Stars: ✭ 6,029 (+526.06%)
Mutual labels:  hacktoberfest, webassembly, wasm
Wasm Json Toolkit
[ORPHANED] A small toolkit for converting wasm binaries into json and back.
Stars: ✭ 23 (-97.61%)
Mutual labels:  webassembly, wasm
Zemeroth
😠⚔️😈 A minimalistic 2D turn-based tactical game in Rust
Stars: ✭ 940 (-2.39%)
Mutual labels:  webassembly, wasm
Wasmboy
Game Boy / Game Boy Color Emulator Library, 🎮written for WebAssembly using AssemblyScript. 🚀Demos built with Preact and Svelte. ⚛️
Stars: ✭ 963 (+0%)
Mutual labels:  webassembly, wasm
Wagon
wagon, a WebAssembly-based Go interpreter, for Go.
Stars: ✭ 882 (-8.41%)
Mutual labels:  webassembly, wasm
Ndarray Vision
Computer vision library built on top of ndarray
Stars: ✭ 17 (-98.23%)
Mutual labels:  hacktoberfest, image-processing
Webrtc
Pure Go implementation of the WebRTC API
Stars: ✭ 8,399 (+772.17%)
Mutual labels:  webassembly, wasm
Terrarium Templates
Template and example projects for Fastly Labs Terrarium https://wasm.fastlylabs.com
Stars: ✭ 21 (-97.82%)
Mutual labels:  webassembly, wasm
Viper
[WIP] A Pythonesque language with a design that focuses on efficiency and expressiveness. Compiles to WebAssembly
Stars: ✭ 23 (-97.61%)
Mutual labels:  webassembly, wasm
Wasm2kt
Web Assembly to Kotlin and Java converter. Allows to compile a C or C++ program/library, and generate a Kotlin or Java program/library.
Stars: ✭ 18 (-98.13%)
Mutual labels:  webassembly, wasm
Cometa
Super fast, on-demand and on-the-fly, image processing.
Stars: ✭ 8 (-99.17%)
Mutual labels:  image-processing, image-manipulation
Gameboy
🎮 Game Boy emulator written in Rust
Stars: ✭ 17 (-98.23%)
Mutual labels:  webassembly, wasm
Notecalc3
NoteCalc is a handy calculator trying to bring the advantages of Soulver to the web.
Stars: ✭ 879 (-8.72%)
Mutual labels:  webassembly, wasm
Node Wasm
Import and use wasm in node
Stars: ✭ 28 (-97.09%)
Mutual labels:  webassembly, wasm
Wasm Check
TypeScript / JavaScript library for detect WebAssembly features in node.js & browser
Stars: ✭ 30 (-96.88%)
Mutual labels:  webassembly, wasm
Wasmsign
A tool to add and verify digital signatures to/from WASM binaries
Stars: ✭ 31 (-96.78%)
Mutual labels:  webassembly, wasm

photon

Photon banner, showing the Photon logo on a dark background

Photon

Status GitHub Issues GitHub Pull Requests Gitter chat NPM Monthly Downloads Continuous Integration


High-performance, cross-platform Rust/WebAssembly image processing library

📝 Table of Contents

Photon is a high-performance Rust image processing library, which compiles to WebAssembly, allowing for safe, blazing-fast image processing both natively and on the web.

You can run Photon:

  • natively
  • in the browser with WebAssembly
  • on Node with WebAssembly

Features

  • Fast: On the web, Photon's high-performance allows it to run at near-native speed. Benchmarks can be found here.
  • Call with JS: Want to use Photon on the web or with Node? Using a simple npm package, you're good to go. Get all the benefits of WebAssembly with zero-cost abstraction.
  • Use Natively: For command-line apps, native photo editing apps, and so forth, Photon's core codebase is in Rust, allowing for cross-platform development.
  • Pure Rust - Unlike other libraries, 100% of the library's codebase is written in Rust, so security and safety is guaranteed.

Supported Image Formats

The following image formats are supported:

  • PNG
  • JPEG
  • BMP
  • ICO
  • TIFF

Live Demo

View the official demo of WASM in action.

Photon In Action

Imgur

Version 0.3.0 Updates

Version 0.3.0 is currently in development, and will be expected to complete mid-December. Features include:

  • Node.js image resizing
  • Improved performance
  • Faster encoding of images, thanks to updating dependencies to the image crate

Get Started

Getting Started Guide

Check out Photon's getting started guide, complete with tutorials, installation instructions, and more

📚 Documentation

View the official documentation.

Functions

96 customisable functions are available, for varying image effects.

Functions include:

  • Image correction: Hue rotation, sharpening, brightness adjustment, adjusting saturation, lightening/darkening all within various colour spaces.
  • Resizing: Resize images both natively and on the web.
  • Convolutions: Sobel filters, blurs, Laplace effects, edge detection, etc.,
  • Channel manipulation: Increasing/decreasing RGB channel values, swapping channels, removing channels, etc.
  • Monochrome effects: Monochrome tints, greyscaling of various forms, thresholding, sepia, averaging RGB values
  • Colour manipulation: Work with the image in various colour spaces such as HSL, LCh, and sRGB, and adjust the colours accordingly.
  • Filters: Over 30 pre-set filters available, incorporating various effects and transformations.
  • Watermarking: Watermark images in multiple formats.
  • Blending: Blend images together using 10 different techniques, change image backgrounds.

Get Started Natively

Install

Add the following line to the dependencies section of your Rust project's Cargo.toml:

Cargo.toml
[dependencies]
photon-rs = "0.2.0"

Using Photon Natively

The following code opens an image from the filesystem, applies an effect, and outputs it as a PNG.

Here is a code sample to get you started:

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(())
}
See More Examples

For more examples, check out the guide on how to get started with Photon natively.

Building WebAssembly package

In order to build the WebAssembly package you will need wasm-pack. Check https://rustwasm.github.io/wasm-pack/installer/ on how to install it. Then you can run the command:

wasm-pack build ./crate

Get Started With WebAssembly

Using a Bundler?

Installing Photon

If you're using Webpack or a bundler to build your project, install Photon via npm:

npm install @silvia-odwyer/photon

You can run Photon directly in any web browser that supports WebAssembly, which includes Chrome, Firefox, Safari, and Edge.

Get Started with Photon on The Web

To get started, check out the guide.

Using NodeJS?

If you're intending to use Photon with NodeJS, you can install the NodeJS version of the library:

npm install @silvia-odwyer/photon-node

Modules

Photon contains a series of modules, which include:

  • effects: Various image effects, including adding offsets, thresholding, duotoning, solarization, etc.,
  • channels: Functions related to increasing/decreasing the red, green, and blue channels of the image data.
  • filters: Preset filters, which alter the rgb channels of the image. Contains over 20.
  • conv: Laplace, Sobel, emboss; image proc functions which require image convolution.
  • noise: Noise generation of varying tints and hues.
  • multiple: A module for dealing with multiple images, such as watermarking images, etc.,
  • correction: Hue rotation, adjusting saturation, lightening/darkening: all techniques available in multiple colour spaces, which lead to varying effects.

Quick Start Example

Clone this repo:

git clone https://github.com/silvia-odwyer/photon

Run the binary, which will perform an image processing function on an image:

cargo run --release

Compare the original image with the outputted image, and you'll see the desired effect has been applied.

Got Questions?

If you have further questions about this library, you can ask them on Gitter or Spectrum, and I'll get back to you!

If there are any issues involving running/using the library, make sure to open an issue, it would be greatly appreciated, and will help improve the library.

Additional Notes

Functions have been designed with flexibility in mind, so that full customization of effects and filters can be utilised; for every function, hundreds of differing image effects/tints/hues can be created, just by changing parameters slightly, so with every function comes the ability to fully experiment.

For developers who would like to work with high-level constructs can do so, such as applying effects to imagery (eg: Laplace or Sobel) or filters; this library provides a complete suite of functions to do so, as well as in-built filters and presets.

photon can be thought of as a high-level wrapper to the Rust image crate, but conversely also includes functions which provide low-level access to pixel and channel manipulation, perfect for developers who wish to work with this data directly.

Contributing

Photon is always ready for new filters and functions, so if you'd like to contribute, we're always ready to accept new Pull Requests or investigate new issues.

To Do

  • Selective colorization
  • Fade
  • Pixelisation
  • Blend images using browser-specific functions for WASM version of library.
  • Vintage images with light leaks, grains, etc.,
  • Normalisation
  • Gamma correction
  • Duotone filtering
  • Tests in a headless web browser for WebAssembly version of library

Contributors

  • Silvia O'Dwyer - @silvia-odwyer
  • Ivan Zvonimir Horvat - @Horki
  • Future You(?) - (See Contributing above ;)

License

This project is licensed under the Apache 2.0 License - see the LICENSE.md file for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].