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
not sure if this is already a feature and I just didn't find it in the documentation and generated diff object properties after the function analysis, but it would be good to have the information if the software has found differences between the two images. If there are no differences, I would like to avoid saving these images.
Maybe something like
var diffImg = pixelmatch(img1, img2, diff, 800, 600, {threshold: 0.1, GenerateNoDiff: true});
// if "GenerateNoDiff" is set to false and no diff was found, the function returns null. If differences were found, it returns the regular obj
// if "GenerateNoDiff" is set to to true, the function always returns the obj
or maybe as part of the generated obj
var diffImg = pixelmatch(img1, img2, diff, 800, 600, {threshold: 0.1});
// diffImg.diff will be true if differences were found or false, if no differences were found
Thanks :)
The text was updated successfully, but these errors were encountered:
Have the same request, for now checking manually if the PNG contains pixels of the difference color
constcontainsRed=(png)=>{const{data}=png;for(leti=0;i<data.length;i+=4){if(data[i]===255&&data[i+1]===0&&data[i+2]===0){returntrue;}}returnfalse;}constdifferentScreenshots=(baseline,screenshot)=>{constimg1=PNG.sync.read(fs.readFileSync(baseline));constimg2=PNG.sync.read(fs.readFileSync(screenshot));const{width, height}=img1;constdiff=newPNG({width, height});pixelmatch(img1.data,img2.data,diff.data,width,height,{threshold: 0.1});// check if diff contains pixel of difference, 255;0;0 by defaultconstisDifferent=containsRed(diff);if(isDifferent){fs.writeFileSync('pics/diff.png',PNG.sync.write(diff));}returnisDifferent}
Hi,
not sure if this is already a feature and I just didn't find it in the documentation and generated diff object properties after the function analysis, but it would be good to have the information if the software has found differences between the two images. If there are no differences, I would like to avoid saving these images.
Maybe something like
or maybe as part of the generated obj
Thanks :)
The text was updated successfully, but these errors were encountered: