Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/astronomersiva/placeholder-img
Generates low-res blurred version of images that can be used as placeholders while lazy-loading them
https://github.com/astronomersiva/placeholder-img
image-processing lazy-loading
Last synced: about 2 months ago
JSON representation
Generates low-res blurred version of images that can be used as placeholders while lazy-loading them
- Host: GitHub
- URL: https://github.com/astronomersiva/placeholder-img
- Owner: astronomersiva
- Created: 2018-08-08T15:40:50.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-08-08T17:06:09.000Z (over 6 years ago)
- Last Synced: 2024-10-13T20:47:20.652Z (3 months ago)
- Topics: image-processing, lazy-loading
- Language: JavaScript
- Size: 73.2 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# placeholder-img [![Build Status](https://travis-ci.org/astronomersiva/placeholder-img.svg?branch=master)](https://travis-ci.org/astronomersiva/placeholder-img)
Generates low-res blurred versions of images that can be used as placeholders while lazy-loading them.
### Installation
* `npm install --save placeholder-img`
### Usage
* To create a placeholder image file,
```
const placeholderImg = require('placeholder-img');const src = 'path/to/image';
await placeholderImg.toFile(src, /* optional destination */);
```
If the destination is not provided, the image will be saved to `${SRC}-placeholder.${FORMAT}`.* To generate the placeholder image in base64 encoding,
```
const placeholderImg = require('placeholder-img');const src = 'path/to/image';
const base64Image = await placeholderImg.toBase64(src);
```### License
MIT © [Sivasubramanyam A](https://sivasubramanyam.me)