PitchHut logo
A Rust-powered, zero-dependency alternative to Sharp.
Pitch

Stop struggling with libvips errors on Lambda/Alpine. lazy-image is a high-performance Node.js image engine that compiles to a single static binary. It features a Zero-Copy architecture for speed and produces 10% smaller JPEGs than Sharp by default using mozjpeg.

Description

lazy-image: A Next-Generation Image Processing Engine for Node.js

lazy-image is an advanced image processing engine designed for Node.js, focused on delivering smaller files with better quality and efficiency. Developed with a core in Rust and utilizing state-of-the-art compression technologies such as mozjpeg and AVIF, it ensures a balance between performance and memory efficiency.

Key Features

  • Optimized File Sizes: Reduces image sizes significantly compared to traditional methods, achieving up to -9.7% smaller files for JPEG and -13.2% for complex pipelines when compared to similar libraries.
  • Fast Processing Speeds: Processes images faster with improved throughput, for example, 1.06x faster for JPEG compression.
  • Cross-Platform Compatibility: Works seamlessly across macOS, Windows, and Linux systems, accommodating various architectures including ARM and x64.
  • Memory Efficiency: Employs a zero-copy architecture to minimize memory usage during image processing. This is particularly beneficial for batch processing applications.
  • Comprehensive Format Support: Supports cutting-edge image formats such as JPEG, AVIF, WebP, and PNG, making it versatile for different use cases.

Benchmarks

Benchmark results have demonstrated significant advantages in file size and processing speed:

File Size Comparison

Formatlazy-imageSharp (libvips + mozjpeg)Difference
JPEG15,790 bytes17,495 bytes-9.7%
WebP6,378 bytes6,362 bytes+0.3%
AVIF5,599 bytes3,683 bytes+52.0%

Processing Speed Comparison

Formatlazy-imageSharpSpeed Ratio
JPEG242 ms257 ms1.06x faster
WebP301 ms233 ms0.77x slower
AVIF267 ms288 ms1.08x faster

These metrics showcase how lazy-image outperforms traditional libraries in both size reduction and processing efficiency.

Usage

With a fluent API design, lazy-image facilitates straightforward image manipulation operations such as resizing, rotating, and format conversion. Here’s a simple JavaScript example for basic usage:

const { ImageEngine } = require('@alberteinshutoin/lazy-image');

const result = await ImageEngine.from('input.png')
    .resize(800, null) // Resize to width 800, auto height
    .rotate(90)        // Rotate by 90 degrees
    .toBuffer('avif', 60); // Convert to AVIF with quality 60

Why Choose lazy-image?

  • Smaller Packages: Unlike other libraries that require large dependencies, lazy-image offers a total installation size between 6-9MB depending on the platform, which is significantly smaller than alternatives.
  • Memory Safety: Built in Rust, it avoids common vulnerabilities like buffer overflows and memory leaks.
  • Serverless Optimized: Designed for modern serverless environments, ensuring quick startup times and minimal resource consumption.

For comprehensive details, including advanced features and usage scenarios, refer to the full documentation.

With lazy-image, manage images on your Node.js applications more effectively—achieve optimized sizes and superior quality seamlessly.

0 comments

No comments yet.

Sign in to be the first to comment.