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

Add equal feedback in createDiff. #45

Open
RamzesTheSecond opened this issue Dec 15, 2018 · 7 comments · May be fixed by #94
Open

Add equal feedback in createDiff. #45

RamzesTheSecond opened this issue Dec 15, 2018 · 7 comments · May be fixed by #94

Comments

@RamzesTheSecond
Copy link

It would be great to know if the images are equal or not when creating diff.

looksSame.createDiff({ ... }, function (error, equal) { ... });

@DudaGod
Copy link
Member

DudaGod commented Dec 15, 2018

Hello.

Can you please describe a use case of this feature?
It is assumed that you need compare images at first and than if they have difference call createDiff method.

Example:

looksSame('ref.png', 'curr.png', (err, equal) => {
  if (!equal) {
    looksSame.createDiff({...}, () => {...})
  }
})

@RamzesTheSecond
Copy link
Author

RamzesTheSecond commented Dec 15, 2018

Yes sure. I need to create a diff image regardless if it has differences or not. I use it for e2e tests and there are scenarios with steps where each step should be visible and additionally I want to show which steps have some difference.

@DudaGod
Copy link
Member

DudaGod commented Dec 17, 2018

Okay, you can do it like I described above:

looksSame('ref.png', 'curr.png', (err, equal) => {
    looksSame.createDiff({...}, () => {...});

    console.log(`Images are equal: ${equal}`);
})

Is it suitable for you?

@RamzesTheSecond
Copy link
Author

Thanks for the answer. Unfortunately it's not the option I need - it simply takes more time to compare images and generate diff. In this case it will take longer than expected. I have loads of scenarios and images to compare.

@DudaGod
Copy link
Member

DudaGod commented Dec 17, 2018

Ok, I understand you.
We are currently busy with other tasks so the PR is welcome. By the way, this is not difficult to do.

@kspace-trk
Copy link

@DudaGod Hello. I have created a Pull Request regarding this issue, could you please take a look at it?
#94

@DudaGod
Copy link
Member

DudaGod commented Sep 14, 2023

@DudaGod Hello. I have created a Pull Request regarding this issue, could you please take a look at it?

Hello. Did you try to use lookSame with option createDiffImage: true? In this case the execution speed should be the same as when calling createDiff.

You can use it like:

const {equal} = await looksSame('image1.png', 'image2.png', {createDiffImage: true});

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