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

sickle

v1.1.1

Published

All purpose image resizing, caching and output for Node.JS

Downloads

3

Readme

Build Status npm version

All purpose image proxy for resizing, caching and output.

Sickle.js is pretty simple - you set it up to store your files in a cache directory...

var sickle = new Sickle({
    scaleUp: false, // scale images up to required dimensions - defaults to false
    quality: 90, //set quality of output - default is 90
    cacheDirectory: "./path/to/cache/directory" // the directory in which to store your cache (must be writable)
});

then you send it a reachable URL via an object with these dimensions...


sickle.get({
	url: "https://github.com/marksyzm/sickle/raw/master/src/design/sickle.png",
	width: 50,
	height: 50,
	crop: true
}, function (err, image) {
	if (image) {
		res.setHeader("content-type", "image/png")
		res.end(image.data, "binary");
	} else res.end("Aaaargh!");
});

You can use the callback to retrieve an image object that outputs something like this:

{
  "Format": "PNG (Portable Network Graphics)",
  "format": "PNG",
  "Geometry": "300x225",
  "size": {
    "width": 300,
    "height": 225
  },
  "Class": "DirectClass",
  "Type": "true color",
  "Depth": "8 bits-per-pixel component",
  "depth": 8,
  "Channel Depths": {
    "Red": "8 bits",
    "Green": "8 bits",
    "Blue": "8 bits",
    "Opacity": "1 bits"
  },
  "Channel Statistics": {
    "Red": {
      "Minimum": "0.00 (0.0000)",
      "Maximum": "255.00 (1.0000)",
      "Mean": "94.23 (0.3695)",
      "Standard Deviation": "94.89 (0.3721)"
    },
    "Green": {
      "Minimum": "0.00 (0.0000)",
      "Maximum": "255.00 (1.0000)",
      "Mean": "93.47 (0.3665)",
      "Standard Deviation": "95.44 (0.3743)"
    },
    "Blue": {
      "Minimum": "0.00 (0.0000)",
      "Maximum": "255.00 (1.0000)",
      "Mean": "104.71 (0.4106)",
      "Standard Deviation": "91.76 (0.3598)"
    },
    "Opacity": {
      "Minimum": "0.00 (0.0000)",
      "Maximum": "0.00 (0.0000)",
      "Mean": "0.00 (0.0000)",
      "Standard Deviation": "0.00 (0.0000)"
    }
  },
  "Filesize": "1.6Ki",
  "Interlace": "No",
  "Orientation": "Unknown",
  "Background Color": "white",
  "Border Color": "#DFDFDF00",
  "Matte Color": "#BDBDBD00",
  "Page geometry": "300x225+0+0",
  "Compose": "Over",
  "Dispose": "Undefined",
  "Iterations": "0",
  "Compression": "Zip",
  "Png:IHDR.color-type-orig": "6",
  "Png:IHDR.bit-depth-orig": "8",
  "Signature": "4d697a99459ed0aa2dd2e83d1b193ea8a2cee594e8f383f33059688b0f50398b",
  "Tainted": "False",
  "path": "/path/to/cache/50-50-nocrop/c27103e5906b5689a8211b7b9d25aef2",
  "data": "<Buffer 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 01 2c 00 00 00 e1 08 06 00 00 00 72 7c 88 ab 00 00 00 06 62 4b 47 44 00 ff 00 ff 00 ff a0 bd a7 93 ...>"
}

Holy farking schnit!

Then... uh... that's it. The crop option centers and crops the image within the dimensions too, for laffs.

Dependencies

GraphicsMagick

Install

npm install sickle --save

Test

Test it from the module directory via npm test