Package Exports
- blend
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (blend) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
node-blend
This module can re-encode one or more images of the same size. It supports stiching multiple images together into a single image, alpha-compositing, color quantization, and various compression options to produce highly optimized output.
Usage
var blend = require('blend');
var image1; // Contains a compressed PNG image as a buffer.
var image2;
blend([ image1, image2 ], function(err, result) {
// result contains the blended result image compressed as PNG.
});
blend([ image1, image2 ], {
format: 'jpeg',
quality: 90
}, function(err, result) {
// result contains the blended result image compressed as JPEG.
});Options
format:jpeg,png, orwebpquality: integer indicating the quality of the final image. Meaning and range differs per format. For JPEG and webp the range is from 0-100. It defaults to 80. The lower the number the lower image quality and smaller the final image size. For PNG range is from 2-256. It means the # of colors to reduce the image to using. The lower the number the lower image quality and smaller the final image size.width: integer, default 0: final width of blended image. If options provided with no width value it will default to 0height: integer, default 0: final width of blended image. If options provided with no height value it will default to 0reencode: boolean, default falsematte: when alpha is used this is the color to initialize the buffer to (reencode will be set to true automatically when a matte is supplied)compression: level of compression to use when format ispng. The higher value indicates higher compression and implies slower encodeing speeds. The lower value indicates faster encoding but larger final images. Default is 6. If the encoder islibpngthen the valid range is between 1 and 9. If the encoder isminizthen the valid range is between 1 and 10. The reason for this difference is thatminizhas a special "UBER" compression mode that tries to be extremely small at the potential cost of being extremely slow.palette: pass a blend.Palette object to be used to reduced PNG images to a fixed array of colorsmode:octreeorhextree- the PNG quantization method to use, from Mapnik: https://github.com/mapnik/mapnik/wiki/OutputFormats. Octree only support a few alpha levels, but is faster while Hextree supports many alpha levels.encoder:libpngorminiz- the PNG encoder to use.libpngis standard whileminizis experimental but faster.
Installation
npm install blend@latestDevelopment
To run tests for this module, run npm install --dev to install the testing framework, then
npm test. Tests require Imagemagick for its compare utility.