Skip to content

A Metalsmith plugin to dither images, based on DitherJS.

Notifications You must be signed in to change notification settings

lucawyss/metalsmith-dither

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Stars

Watchers

Forks

Releases

No releases published

Packages