gen-img-placeholder

0.1.1 • Public • Published

Generate Image Placeholder

A cli tool which generates a json with base64 placeholders for a given set of images.

The tool resizes each image to a given size and transforms it into a base64 string which later on can be used as value for the src attribute of an img element until the full image is being loaded.

Installation

npm install -g gen-img-placeholder

Usage

gen-img-placeholder [options] <images glob pattern>

Options:

  • -h, --help - output usage information
  • -V, --version - output the version number
  • -s, --size - New size for the placeholder, in percentage (default: 1%)
  • -o, --output - Path for the output json (default: stdout)

Example

gen-img-placeholder -s 1 -o './placeholders.json' 'assets/**/*.png'

Package Sidebar

Install

npm i gen-img-placeholder

Weekly Downloads

10

Version

0.1.1

License

MIT

Last publish

Collaborators

  • idoesh