-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
getImageDataUrl doesn't exist on the diff data object #8
Comments
@franck34 var png = data.getDiffImage();
var imageName = "out.png";
png.pack().pipe(fs.createWriteStream(imageName));
png.on('parsed', function() {
return png.pack().pipe(fs.createWriteStream(imageName));
}); |
Same here, but i had to clone another branch because getDiffImage does not exist on master branch. I did it few hours ago. But curiously branches vanished from github. Or perhaps i'm really tired ?? |
Ha. Got it. Was using this fork : https://github.com/nikrolls/node-resemble |
@jkieley this repo does not contain any "getDiffImage" occurence :) |
@jkieley here is what I did and it seems to work: var fs = require('fs');
var resemble = require('node-resemble');
var img1 = fs.readFileSync('before.png');
var img2 = fs.readFileSync('after.png');
resemble(img1).compareTo(img2).onComplete(function(data){
var png = data.getImageDataUrl();
var base64Data = png.replace(/^data:image\/png;base64,/, "");
fs.writeFile("out.png", base64Data, 'base64', function(err) {
console.log(err); // if any
});
}); |
getImageDataUrl doesn't exist on the diff data object. I get
{ isSameDimensions: false,
dimensionDifference: { width: 0, height: -154 },
misMatchPercentage: '22.48',
analysisTime: 346,
getDiffImage: [Function] }
}
It looks like getDiffImage, returns a node stream... But I'm unable to write it to a file... could you give an example?
The text was updated successfully, but these errors were encountered: