photon
image
Our great sponsors
photon | image | |
---|---|---|
6 | 37 | |
2,472 | 4,490 | |
- | 2.4% | |
6.7 | 9.1 | |
20 days ago | 6 days ago | |
Rust | Rust | |
Apache License 2.0 | Apache License 2.0 |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
photon
-
Show HN: OS Image processing API running on edge functions using Rust and WASM
Image processing/transformations with built-in CDNs is one of the more common solutions you would find out there but can get pretty expensive and locked in over time.
Vercel is a good example that provides a built-in “next/image” solution for the NextJS framework that optimises images for better performance, however, it gets very expensive as you scale.
Alternatively, running your own service with one of the most common image processing libraries like SharpJS is great but can get pretty difficult to run in a serverless environment with CDNs and all the other bells and whistles alongside all your other code while the cold startup time of Sharp in a serverless environment can be pretty brutal.
With all the growth around rebuilding engines in Rust for performance gains, I thought there must be an image processing library written in Rust which could be compiled to WebAssembly (WASM) and run way faster. That’s when I discovered Photon https://github.com/silvia-odwyer/photon by Silvia, who has done amazing work with the library.
This eventually led me to discover https://github.com/fineshopdesign/cf-wasm/tree/main/packages... that has already transcribed the Photon package into a WASM binary for easy use in edge v8 environments like Cloudflare workers or NextJS Edge functions.
Using these packages I built an API layer on the NextJS framework allowing you to easily process local and remote images at blazing fast speeds with a bunch of helper functions making it similar to use as most paid Image processing APIs. If hosted on Vercel, you can make use of the built-in CDN cache for files less than 10 MB at no extra charge with Edge caching.
Some of the features:
- Blazing fast image processing
- Fully serverless, runs on Vercel Edge functions
- Resize, crop, compress, tint, rotate, format and more
- Global distribution with Edge functions
- Automated CDN cache with Edge functions
- Replacement for `next/image` processing on Vercel
- Local and remote image processing
Some problems:
- The Photon lib has last been updated in 2020
- There are still a few obvious bugs when using it for more advanced requirements like 8k image processing on edge function due to poor memory management in Rust
- No sexy features right now like AI image optimisation and selective background blurring
- If you are looking for an all-in-one solution with Image Storage + image processing/CDN, this is not it (something we will be releasing soon on JigsawStack.com)
I think the Photon library and the API have a lot more potential for growth and will be hoping for more contributions from the community as Rust gets more popular!
-
Building an online image compressor
My first implementation was based on photon_rs, a Rust based web assembly library for image processing. It worked pretty well, but it was slower than OP website. Without digging much it seems logical since photon isn’t optimized for performance.
- Rust/WebAssembly image processing library
-
Image Compression Library
What you describe reminded me of photon. Check out the website. If there isn't an overlap of functionality then you can definitely integrate it into your own site.
- Off my chest: When are some of you browser devs gonna give us native image scaling? This is the best we got ATM.
-
Monitoring UX in Single Page Applications
For the image, you are able to either use your webcam to take a photo, or upload a photo of your own before moving onto the filters. Image filtering is included in most image manipulation libraries. I had used ImageMagick before, but had a terrible time with it. I wanted to find a better way to do Instagram-like filtering. I came across Photon, a high performance image processing library written in Rust and can be compiled to WebAssembly, and there was already a React demo so it was easy to integrate. Once you choose the filter you want, you move onto the decoration stage.
image
-
Transitioning From PyTorch to Burn
With the help of the image crate, loading an image from disk is fairly straightforward.
-
CVE-2023-4863: Heap buffer overflow in WebP (Chrome)
FTR there is a WebP decoder implementation in safe Rust in the image crate: https://github.com/image-rs/image
It used to be quite incomplete for a long time, but work last year has implemented many webp features. Chromium now has a policy of allowing the use of Rust dependencies, so maybe Chromium could start adopting it?
-
Porting a local app to Web
Hello! So I have a local app that I am currently running on desktop (windows). I'm using egui for the UI, and the program basically opens a folder, gets all the images in the folder, and then uses the image-rs library to resize and create a grid of images / some other operations.
- Setting the DPI of an image before saving it
-
png crate gets an ultrafast compression mode, up to 4x faster decompression
png is the de-facto standard Rust crate for reading and writing PNG images, used e.g. by the image crate.
-
What's everyone working on this week (12/2023)?
There's also a CLI to convert between formats. It uses the crate image.
-
The `exr` crate got up to 3x faster, even better performance coming soon
exr is a is a 100% Rust and 100% safe code library for reading and writing OpenEXR images. It is used by the popular image crate to read and write OpenEXR.
-
Announcing zune-jpeg: Rust's fastest JPEG decoder
We're currently looking for contributors to add support for zune-jpeg to the image crate. The image maintainers are open to it, but don't have the capacity to do it themselves. You can find more details here.
-
Does the rust image crate support paletted png?
It would be helpful to contribute to the general change towards an untyped buffer with runtime representations for color space information and fallible conversions. (https://github.com/image-rs/image/pull/1718). It's currently stalling on having too few eyeballs to judge the impact and need for that complexity.
-
picst - a CLI tool to resize clipboard images on the fly
It uses https://github.com/1Password/arboard and https://github.com/image-rs/image under the hood. I haven't tested deeply but I assume it should handle many formats out of the box.
What are some alternatives?
InputBot - Rust library for creating global hotkeys, and simulating inputs
opencv-rust - Rust bindings for OpenCV 3 & 4
Kubewarden - Kubewarden is a policy engine for Kubernetes. It helps with keeping your Kubernetes clusters secure and compliant. Kubewarden policies can be written using regular programming languages or Domain Specific Languages (DSL) sugh as Rego. Policies are compiled into WebAssembly modules that are then distributed using traditional container registries.
imageproc - An advanced image processing library for Rust.
Quicksilver - Quicksilver Project Source
imageproc (PistonDevelopers) - Image processing operations
jpegoptim - jpegoptim - utility to optimize/compress JPEG files
rust-ndarray - ndarray: an N-dimensional array with array views, multidimensional slicing, and efficient operations
menyoki - Screen{shot,cast} and perform ImageOps on the command line 🌱 🏞️
oxipng - Multithreaded PNG optimizer written in Rust
purrybooth - v cute photo booth
Raster - An image processing library for Rust