npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

bkjs-wand

v0.5.3

Published

Imagemagick wand support for node.js and backendjs

Downloads

481

Readme

ImageMagick wand module for node and backendjs

Requirements

Installing dependencies on CentOS:

yum -y install libpng-devel libjpeg-turbo-devel

Installing dependencies on Mac OS X using macports:

port install libpng jpeg

Usage

  • resizeImage(source, options, callback) - resize image using ImageMagick
    • source can be a Buffer or file name
    • options can have the following properties:
      • width - output image width, if negative and the original image width is smaller than the specified, nothing happens
      • height - output image height, if negative and the original image height is smaller this the specified, nothing happens
      • quality - 0 - 99
      • out - output file name
      • ext - image extention
      • outfile - a filename where to save scaled image, if not given the binary image data is passed to the callback
      • frame - which frame to resize for animated GIFs, 0 is default, -1 to convert all frames
      • no_animation - if set to 1 it will convert GIF animation, otherwise animated GIF is simply returned as is
      • posterize - levels, 2,3,4
      • dither - 1 to dither
      • normalize - 1 to normalize image
      • quantize - number of colors
      • treedepth - 0 or 1 for quantize
      • flip - 1 to flip image
      • flop - 1 1 to flop image
      • blur_radius - radius in pixels
      • blur_sigma - std deviation in pixels
      • sharpen_radius - radius in pixels
      • sharpen_sigma - std deviation in pixels
      • brightness - -100 - 100
      • contrast - -100 - 100
      • rotate - degrees
      • opacity - 0 - 1.0
      • crop_width - crop coordinates
      • crop_height
      • crop_x
      • crop_y
      • bgcolor - RGB for background
      • filter - box, triangle, hermite, hanning, hamming, blackman, gaussian, quadratic, cubic, catrom, mitchell, lanczos, kaiser, welsh, parzen, bohman, barlett, lagrange, jinc, sinc, sincfast, lanczossharp, lanzos2, lanzos2sharp, robidoux, robidouxsharp, cosine, spline, lanczosradius
      • colorspace - rgb, gray, transparent, ohta, xyz, ycbcr, ycc, yiq, ypbpr, yuv, cmylk, srgb, hls, hwb
      • gravity - northwest, north, northeast, west, center, east, southwest, south, southeast

On return the callback will receive the image data if no outfile was specified or null, and the third argument if an object with the result image information: file, ext, height, width, orientation, rotation.

The original image dimentions are returned as _width and _height.

The file where the image is sved will have the actual extention, if the outfile parameter contains invalid extention it will be replaced with the actual resulting image type.

  require("bkjs-wand").resizeImage("a.png", { width: 120, height: 120 }, function(err, data, info) {
     if (!err) fs.writeFile("b.png", data);
     console.log(err, info);
  })

Author

Vlad Seryakov