Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
lib
 
 
 
 
 
 
 
 
 
 
 
 

readme.md

metalsmith-dither

A Metalsmith plugin to dither images, based on DitherJS.

The script take the image matching the pattern and make a dithered copy of the file, with a suffix added at the basename. The dithering effects can use of 'atkinson' or 'ordered' algorithm. A color palette can be applied to the image. By default, the palette is black & white. The last parameter is the step for the pixel quantization ... in short the size of the pixel.

The script is dependent of Jimp library.

Install

npm install --save metalsmith-dither

usage

var Metalsmith = require('metalsmith');
var dither = require('metalsmith-dither');

var metalsmith = new Metalsmith(__dirname)
  .use(dither())
  .build();

Options

  .use(dither({
    pattern: "**/*.jpg", // using minimatch
    step: 1, // The step for the pixel quantization n = 1,2,3...
    palette: [[0,0,0],[255,255,255]], // an array of colors as rgb arrays
    suffix: '-dither', // suffix added to the basename of the file dithered
    algorithm: 'ordered' // dithering algorithm can be 'atkinson'
  }))

Credits

The script is a fork of DitherJS by Daniele Piccone adapted into the node context.

license MIT

About

A Metalsmith plugin to dither images, based on DitherJS.

Resources

Releases

No releases published

Packages

No packages published
You can’t perform that action at this time.