Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var fs = require('fs'),
- PNG = require('pngjs').PNG;
- fs.createReadStream('s.png')
- .pipe(new PNG({
- filterType: 4
- }))
- .on('parsed', function() {
- for (var y = 0; y < this.height; y++) {
- for (var x = 0; x < this.width; x++) {
- var idx = (this.width * y + x) << 2;
- if(this.data[idx] != 0 && this.data[idx] != this.data[idx+1]) {
- console.log(y, x)
- }
- }
- }
- this.pack().pipe(fs.createWriteStream('out.png'));
- });
Add Comment
Please, Sign In to add comment