8000 Feature: ignore rectangle · Issue #32 · gemini-testing/looks-same · GitHub
[go: up one dir, main page]

Skip to content

Feature: ignore rectangle #32

Open

Description

@skyiea

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?

Activity

  1. scottrippey commented on Mar 21, 2019

    @scottrippey

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

  2. DudaGod commented on Mar 21, 2019

    @DudaGod
    Member

    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? ;)

  3. krgolovan commented on Mar 27, 2019

    @krgolovan

    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
        //     ]
        // }
    });
    
  4. DudaGod commented on Mar 27, 2019

    @DudaGod
    Member

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

  5. krgolovan commented on Mar 27, 2019

    @krgolovan

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0