Small PNG crop utility, written in pure JS for Node.
npm install png-crop
(Check out the example folder.)
Both methods take a image path/stream/buffer as input, and a configuration with the keys
height (mandatory, can be arbitrarily large) and
var PNGCrop = ;// if you don't know the image's dimension and want to crop for a point all the// way til bottom right, just pass a big width/heightvar config1 = width: 100 height: 62 top: 95 left: 110;// pass a path, a buffer or a stream as the inputPNGCrop;
var PNGCrop = ;// optionally pass top and left to the configurations as the upper left corner// from which to start croppingvar config2 = width: 53 height: 114;var imgBuffer = fs;PNGCrop;