image-size: [TypeError: Corrupt JPG, exceeded buffer limits]
Trying to calculate the following image throws an exception:
var imagesize = require("image-size");
var url = "http://www.niemanlab.org/images/renewalinvoice.jpg";
var needle = require('needle');
var stream = needle.get(url);
stream.on('readable', function( ) {
var chunk;
while( chunk = this.read() ) {
info = imagesize(chunk);
if( info ) {
stream.end();
console.log('streaming picture', info);
}
}
});
stream.on('end', function(){
console.log('Stream ended');
});
About this issue
- Original URL
- State: open
- Created 9 years ago
- Comments: 16 (1 by maintainers)
FYI I had this error as well, but I found out it was because the images I was using were saved as CMYK file type instead of RGB. Once I changed the images to RGB the script worked.
try https://github.com/nodeca/probe-image-size, it works with examples from this thread
@Gatunox use https://github.com/nodeca/probe-image-size instead