You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 18, 2024. It is now read-only.
I'm creating an application to compare one image to multiples images in a folder. I'm creating this application with Electron and React.
I pass 2 Buffers. As you can see, the Buffers are the same at the first entry, but it gives the same results.
There's how I use rembrandt:
letmainImg=fs.readFileSync('/Users/mboutin2/Desktop/12798992_10207498962925066_4475804348577634517_n.jpg');data.forEach((file)=>{smb2Client.readFile('Mike\\'+file,function(err,data){if(err){console.log("Error (readdir):\n",err);console.log("data",data);}else{//console.log("File ->", file);constrembrandt=newRembrandt({// `imageA` and `imageB` can be either Strings (file path on node.js,// public url on Browsers) or BuffersimageA: mainImg,imageB: data,// Needs to be one of Rembrandt.THRESHOLD_PERCENT or Rembrandt.THRESHOLD_PIXELSthresholdType: Rembrandt.THRESHOLD_PERCENT,// The maximum threshold (0...1 for THRESHOLD_PERCENT, pixel count for THRESHOLD_PIXELSmaxThreshold: 1,// Maximum color delta (0...255):maxDelta: 20,// Maximum surrounding pixel offsetmaxOffset: 0,renderComposition: false,// Should Rembrandt render a composition image?});rembrandt.compare().then(function(result){console.log('\n\n\n');console.log(data);console.log(mainImg);console.log('Passed:',result.passed)console.log('Pixel Difference:',result.differences,'Percentage Difference',result.percentageDifference,'%')console.log('Composition image buffer:',result.compositionImage)// Note that `compositionImage` is an Image when Rembrandt.js is run in the browser environment}).catch((e)=>{console.error(e)})}});});
Is there something I do wrong?
The text was updated successfully, but these errors were encountered:
<html>
<head>
<title></title>
</head>
<body>
<img src="01.jpg" class="image1">
<img src="02.jpg" class="image2">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="rembrandt.min.js"></script>
<script>
const rembrandt = new Rembrandt({
// `imageA` and `imageB` can be either Strings (file path on node.js,
// public url on Browsers) or Buffers
imageA: $('.image1').attr('src'),
imageB: $('.image2').attr('src'),
thresholdType: Rembrandt.THRESHOLD_PERCENT,
// The maximum threshold (0...1 for THRESHOLD_PERCENT, pixel count for THRESHOLD_PIXELS
maxThreshold: 0,
// Maximum color delta (0...255):
maxDelta: 0,
// Maximum surrounding pixel offset
maxOffset: 0,
})
// Run the comparison
rembrandt.compare()
.then(function (result) {
if(result.passed){
alert('Yes');
} else {
alert('No');
}
})
</script>
</body>
</html>
I'm creating an application to compare one image to multiples images in a folder. I'm creating this application with Electron and React.
I pass 2 Buffers. As you can see, the Buffers are the same at the first entry, but it gives the same results.
There's how I use rembrandt:
Is there something I do wrong?
The text was updated successfully, but these errors were encountered: