How to use png-js - 10 common examples

To help you get started, we’ve selected a few png-js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ckeditor / ckeditor4 / dev / iconmaker / lib / main.js View on Github external
function compareIcons( icon1, icon2, callback ) {
	try {
		fs.statSync( icon1 );
	} catch ( error ) {
		// File doesn't exists. This is a new icon. So yes, it's different.
		return callback( false );
	}

	png.decode( icon1, function( pixels1 ) {
		png.decode( icon2, function( pixels2 ) {
			if ( pixels1.length != pixels2.length )
				return callback( false );

			for ( var i = pixels1.length ; i-- ; ) {
				if ( pixels1[ i ] !== pixels2[ i ] )
					return callback( false );
			}

			return callback( true );
		} );
	} );
}
github eduardolundgren / tracking.js / test / perf / ObjectTracker.js View on Github external
setUp: function(done) {
    PNG.decode('test/assets/faces.png', function(pixels) {
      image = pixels;
      done();
    });
  },
github eduardolundgren / tracking.js / test / perf / Brief.js View on Github external
PNG.decode('test/assets/box1.png', function(pixels1) {
      image1Gray = tracking.Image.grayscale(pixels1, imageWidth, imageHeight);
      corners1 = tracking.Fast.findCorners(image1Gray, imageWidth, imageHeight);
      descriptors1 = tracking.Brief.getDescriptors(image1Gray, imageWidth, corners1);

      PNG.decode('test/assets/box2.png', function(pixels2) {
        image2Gray = tracking.Image.grayscale(pixels2, imageWidth, imageHeight);
        corners2 = tracking.Fast.findCorners(image2Gray, imageWidth, imageHeight);
        descriptors2 = tracking.Brief.getDescriptors(image2Gray, imageWidth, corners1);
        done();
      });
    });
github eugeneware / gifencoder / test / index.js View on Github external
range(0, n).forEach(function (i) {
        png.decode(fixtures('frame' + i + '.png'), function (pixels) {
          frames[i] = pixels;
          next();
        });
      });
github eduardolundgren / tracking.js / test / perf / Brief.js View on Github external
setUp: function(done) {
    PNG.decode('test/assets/box1.png', function(pixels1) {
      image1Gray = tracking.Image.grayscale(pixels1, imageWidth, imageHeight);
      corners1 = tracking.Fast.findCorners(image1Gray, imageWidth, imageHeight);
      descriptors1 = tracking.Brief.getDescriptors(image1Gray, imageWidth, corners1);

      PNG.decode('test/assets/box2.png', function(pixels2) {
        image2Gray = tracking.Image.grayscale(pixels2, imageWidth, imageHeight);
        corners2 = tracking.Fast.findCorners(image2Gray, imageWidth, imageHeight);
        descriptors2 = tracking.Brief.getDescriptors(image2Gray, imageWidth, corners1);
        done();
      });
    });

  },
github eduardolundgren / tracking.js / test / perf / ColorTracker.js View on Github external
setUp: function(done) {
    PNG.decode('test/assets/psmove.png', function(pixels) {
      image = pixels;
      done();
    });
  },
github eduardolundgren / tracking.js / test / perf / Fast.js View on Github external
setUp: function(done) {
    PNG.decode('test/assets/box1.png', function(pixels) {
      image = pixels;
      imageGray = tracking.Image.grayscale(image, imageWidth, imageHeight);

      done();
    });
  },
github bevacqua / shots / index.babel.js View on Github external
              .map(file => new Promise(resolve => png.decode(file, pixels => resolve(pixels))))
            )
github ckeditor / ckeditor4 / dev / iconmaker / lib / main.js View on Github external
png.decode( icon1, function( pixels1 ) {
		png.decode( icon2, function( pixels2 ) {
			if ( pixels1.length != pixels2.length )
				return callback( false );

			for ( var i = pixels1.length ; i-- ; ) {
				if ( pixels1[ i ] !== pixels2[ i ] )
					return callback( false );
			}

			return callback( true );
		} );
	} );
}
github foliojs / pdfkit / lib / image / png.js View on Github external
constructor(data, label) {
    this.label = label;
    this.image = new PNG(data);
    this.width = this.image.width;
    this.height = this.image.height;
    this.imgData = this.image.imgData;
    this.obj = null;
  }

png-js

A PNG decoder in JavaScript

MIT
Latest version published 5 years ago

Package Health Score

66 / 100
Full package analysis

Popular png-js functions

Similar packages