Skip to content
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

Feature: ignore rectangle #32

Open
skyiea opened this issue Dec 24, 2017 · 5 comments
Open

Feature: ignore rectangle #32

skyiea opened this issue Dec 24, 2017 · 5 comments

Comments

@skyiea
Copy link

skyiea commented Dec 24, 2017

Does looks-same support ignoring certain areas (rectangles) during comparison?
I see that gemini, which is using looks-same, allows to ignoreElements. I would expect it (ignoring) is done by means of image-comparison tool?

@scottrippey
Copy link

Similarly, I'd love to have a whitelist of comparison zones too!

@DudaGod
Copy link
Member

DudaGod commented Mar 21, 2019

Hello.

At the moment looks-same is able to compare by regions:

looksSame({source: 'img1', boundingBox: {left: 10, top: 10, right: 20, bottom: 20}}, {source: 'img2', boundingBox: {left: 30, top: 30, right: 40, bottom: 40}}, {...opts}, callback)

But not able to ignore some region. Add this logic is not really difficult looking at this PR - #51. Do you have some free time to contribute? ;)

@krgolovan
Copy link

You can define your ignoring rectangles and then if diffClusters are within those ignoring rectangles you just change equal to true.

looksSame('image1.png', 'image2.png', {stopOnFirstFail: false}, function(error, {equal, diffBounds, diffClusters}) {
    // {
    //     equal: false,
    //     diffBounds: {left: 10, top: 10, right: 20, bottom: 20}
    //     diffClusters: [
    //         {left: 10, top: 10, right: 14, bottom: 14}, // Compare this
    //         {left: 16, top: 16, right: 20, bottom: 20}  // to your  ignoring rectangles
    //     ]
    // }
});

@DudaGod
Copy link
Member

DudaGod commented Mar 27, 2019

To my mind it's not the best solution. It would be much better if looks-same provided API to ignore some areas.

@krgolovan
Copy link

krgolovan commented Mar 27, 2019

To my mind it's not the best solution. It would be much better if looks-same provided API to ignore some areas.

Right! I meant as a temporary solution you can use diffClusters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants