Closed alphacentory closed 9 years ago
Is it a valid png? I cannot do much without a code and the image. I guess it is problem of parsing png (or invalid png format). You can try parse png by pngjs (https://github.com/niegowski/node-pngjs) and check if it is parsed correctly.
I dug into it, and it is a jpg, which would mean I need to convert all images for comparison to png? Or how hard would it be to add a jpg check?
It would not be hard. Generally pull requests are welcome;)
But I am not sure if supporting jpeg is needed. You can do it by yourself, in server lines of code (probalby 1-2 lines).
...just use https://github.com/eugeneware/jpeg-js to decode the jpeg to decode jpeg to buffer. Maybe the conversion form ArrayBuffer to Buffer would be needed (new Buffer( new Uint8Array(ab) ).
I will take a look, and create a pull request little later :D. I am also going to close this.
@lksv @SlevinT I have made the pull request for jpeg support. Please check the pull request:
https://github.com/lksv/node-resemble.js/pull/25/commits/55fb5c4455a44279fb5dabf347996cdee3bde2bd
I am passing the buffer returned after fs.readFileSync
TypeError: Cannot read property 'width' of null at /Users/hulk/github/gameclash/tweetbot/node_modules/node-resemble-js/resemble.js:119:30 at null. (/Users/hulk/github/gameclash/tweetbot/node_modules/node-resemble-js/node_modules/pngjs/lib/png.js:91:13)
at g (events.js:180:16)
at emit (events.js:95:17)
at emit (events.js:117:20)
at Parser._parseSignature (/Users/hulk/github/gameclash/tweetbot/node_modules/node-resemble-js/node_modules/pngjs/lib/parser.js:87:18)
at ChunkStream._process (/Users/hulk/github/gameclash/tweetbot/node_modules/node-resemble-js/node_modules/pngjs/lib/chunkstream.js:186:23)
at ChunkStream.write (/Users/hulk/github/gameclash/tweetbot/node_modules/node-resemble-js/node_modules/pngjs/lib/chunkstream.js:74:10)
at ChunkStream.end (/Users/hulk/github/gameclash/tweetbot/node_modules/node-resemble-js/node_modules/pngjs/lib/chunkstream.js:85:20)
at PNG.end (/Users/hulk/github/gameclash/tweetbot/node_modules/node-resemble-js/node_modules/pngjs/lib/png.js:105:18)