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

imgdiff

v1.0.0

Published

simple image diffing

Downloads

10

Readme

Example

var imagediff = require('imgdiff');

imagediff.calculateImageDifference("test/left.png", "test/right.png")
  .then(function(result) {
    console.log("Total Pixels: ", result.total);
    console.log("Different Pixels", result.different);
    console.log("Percent Different", result.percent);
    console.log("Image Width", result.resultImage.width);
    console.log("Image Height", result.resultImage.height);
    console.log("Image Channels", result.resultImage.channels);
    // result.resultImage.data) is a ndarray suitable for use with save-pixels
});

CLI

$ node imgdiffcli.js
Usage: [original file] [new file] {--result=[output file]} {--diff-image-only}

$ node imgdiffcli.js test/left.png test/right.png
{total: 10000, different: 2500, percent: 0.25}

$ node imgdiffcli.js test/left.png test/right.png --result=result.png
{total: 10000, different: 2500, percent: 0.25}

$ node imgdiffcli.js test/left.png test/right.png --result=result.png --diff-image-only
{total: 10000, different: 2500, percent: 0.25}

$ node imgdiffcli.js test/left.png test/right.png --result=_ | hexdump -C
00000000  89 50 4e 47 0d 0a 1a 0a  00 00 00 0d 49 48 44 52  |.PNG........IHDR|
00000010  00 00 00 64 00 00 00 64  08 06 00 00 00 70 e2 95  |...d...d.....p..|
00000020  54 00 00 00 02 49 44 41  54 78 01 ec 1a 7e d2 00  |T....IDATx...~..|
00000030  00 00 f4 49 44 41 54 ed  c1 51 0d c2 00 00 c5 c0  |...IDAT..Q......|
00000040  f2 32 47 b3 81 5c 6c a0  09 90 c0 0f 4b 43 7a 77  |.2G..\l.....KCzw|
00000050  7b 7d 10 8d 11 95 11 95  11 95 11 95 11 95 11 95  |{}..............|
00000060  11 95 11 95 11 95 11 95  11 95 11 95 11 95 11 95  |................|
*
00000080  11 95 11 95 83 2b dc 9f  fc 85 c7 c9 af 8d a8 8c  |.....+..........|
00000090  a8 8c a8 8c a8 8c a8 8c  a8 8c a8 8c a8 8c a8 8c  |................|
*
000000e0  a8 8c a8 8c a8 8c a8 8c  a8 8c a8 8c a8 8c a8 1c  |................|
000000f0  5c e1 71 92 ef 8c a8 8c  a8 8c a8 8c a8 8c a8 8c  |\.q.............|
00000100  a8 8c a8 8c a8 8c a8 8c  a8 8c a8 8c a8 8c a8 8c  |................|
*
00000120  a8 8c a8 8c a8 bc 01 bf  b5 07 af 03 42 11 01 00  |............B...|
00000130  00 00 00 49 45 4e 44 ae  42 60 82                 |...IEND.B`.|
0000013b