@mv-ps/placeholder
v1.2.0
Published
Create a base64 encoded placeholder image.
Downloads
9
Readme
placeholder
Create a placeholder image either at a specific size or smallest ratio.
Installation
npm i -g @mv-ps/placeholder
Usage
Command Line
$ placeholder --help
$ placeholder create [OPTIONS] <height> <width>
$ placeholder convert <imagePath>
JavaScript
const { create, convert } = require( '@mv-ps/placeholder' );
(async function() {
let img = await create( 1920, 825, { ratio: true, color: '#f0f0f0' } );
})();
let img = convert( 'path/to/image.png' );
Examples
Convert Existing Image to Base64
$ placeholder convert /path/to/image.jpg
Transparent Image w/ Smallest Ratio
$ placeholder create 983 325 -r
Gray Hero Image w/ Smallest Ratio
$ placeholder create 1920 825 -rc '#c7c7c7'
Gray Product Card Image (exact)
$ placeholder create 382 382 -c '#c7c7c7'
Transparent Promo Image (exact)
$ placeholder create 475 678