Skip to content
felixicazaPublic

About

🏞️ A lightweight, fast, multi-environment generator of beautiful low-quality image placeholders.

Topics

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

previewly

🏞️ Previewly

npm version GitHub actions workflow tests status license

A lightweight, fast, multi-environment generator of beautiful low-quality image placeholders.

✨ Features

  • πŸ–ΌοΈ Generates low-quality image placeholders (LQIP) in multiple formats, including Base64, CSS, SVG and color.
  • πŸ“‚ Supports decoding a wide range of image formats, with configurable output encoding. See @napi-rs/image supported formats.
  • 🌐 Supports multiple environments, including server and browser.
  • πŸš€ Provides a simple and intuitive API for generating placeholders.
  • ⚑ Optimized for performance and speed, making it suitable for production use.

πŸ“¦ Installation

Node.js

Previewly requires Node.js 22.23.3 or later. You can install Previewly with its required peer dependency using npm:

$ npm install @napi-rs/image previewly
Using a different package manager?

Using pnpm:

$ pnpm add @napi-rs/image previewly

Using yarn:

$ yarn add @napi-rs/image previewly

Using bun:

$ bun add @napi-rs/image previewly

Browser

You can install Previewly for browser usage with its required peer dependency using npm:

$ npm install @napi-rs/image @napi-rs/image-wasm32-wasi buffer previewly
Using a different package manager?

Using pnpm:

$ pnpm add @napi-rs/image @napi-rs/image-wasm32-wasi buffer previewly

Using yarn:

$ yarn add @napi-rs/image @napi-rs/image-wasm32-wasi buffer previewly

Using bun:

$ bun add @napi-rs/image @napi-rs/image-wasm32-wasi buffer previewly

See the Installation guide for more details.

πŸš€ Usage

See the Usage Guide for examples of generating placeholders in Node.js and browser applications.

βš™οΈ Options

Previewly accepts options for image orientation, placeholder size and format, brightness, saturation, hue, transparency, and EXIF metadata.

See the API Reference for all options, defaults, and types.

⚑ Performance

Previewly was benchmarked against plaiceholder using the same input images and 100 samples per case.

Image Size Previewly Plaiceholder Speedup
landscape-exif.jpg 339.19 KiB ~73 ms ~120 ms 1.6Γ—
pexels-fabianwiktor-3470872.jpg 798.19 KiB ~594 ms ~866 ms 1.5Γ—
portrait-exif.jpg 239.93 KiB ~59 ms ~122 ms 2.1Γ—
transparent.png 2.03 MiB ~61 ms ~318 ms 5.2Γ—

Average results show that Previewly provides lower latency and higher throughput across all tested images.

Note

Results may vary depending on hardware, runtime version and image characteristics. See full technical results in benchmark folder.

πŸ† Credits

This project is highly inspired by @joe-bell/plaiceholder.

πŸ“ Knowledge

Other related projects for the LQIP (Low-Quality Image Placeholders) technique:

Good reading on the topic of LQIP and related techniques:

🀝 Contributing

Contributions to this library are welcome! If you have any ideas for improvements or new features, please feel free to open an issue or submit a pull request. I appreciate your help in making Previewly better for everyone. Please read the CONTRIBUTING.md.

πŸ“„ License

This project is licensed under the MIT License. See the LICENSE file for details.

About

🏞️ A lightweight, fast, multi-environment generator of beautiful low-quality image placeholders.

Topics

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Contributors

Languages