Git Product home page Git Product logo

Comments (6)

mourner avatar mourner commented on September 17, 2024

This is because the two images are quite different (switch between the two images — all the letters shift positions in various degrees). Blink-diff's algorithm is very naive and will ignore any differences if it can find the original pixel somewhere in the vicinity, but this can lead to many false negatives (undetected mismatches) that this library avoids. So it's more of a design decision — it does a pixel-perfect comparison.

from pixelmatch.

nathanmarks avatar nathanmarks commented on September 17, 2024

@mourner

  1. Is the same true for the resemblejs algorithm?
  2. The purpose of my usage is to diff front end components screenshotted via selenium. Do you think it's possible to achieve what I'm looking for in terms of diff clarity with pixelmatch? I'm wondering if the blink-diff algorithm, while naive, suits my needs better due to the nature of the tests as seen above.

from pixelmatch.

mourner avatar mourner commented on September 17, 2024

To make the diff clearer, try increasing the threshold for pixelmatch. I believe resemble-js isn't very sensitive to differences as well. It can be good enough if you want to detect really noticeable differences like a huge object absent on one of the images, but the goal of this library was to create a very sensitive library suitable for testing a graphics-heavy map rendering engine across platforms.

from pixelmatch.

mourner avatar mourner commented on September 17, 2024

@nathanmarks ah damn, now I see what's going on. The two images you compare have different dimensions — the first is 156px width and the second 154px. This breaks the comparison completely because the pixel positions are shifted. I think I need to add a warning to the command line tool if the dimensions of two images don't match.

from pixelmatch.

nathanmarks avatar nathanmarks commented on September 17, 2024

@mourner

Is it possible to anchor the smaller image? This is the two images in photoshop with layer mode difference and 58% opacity:

image

from pixelmatch.

mourner avatar mourner commented on September 17, 2024

@nathanmarks possible, but I'd like to keep the tool simple. I think it's fair to require equal dimensions, and if someone wants a workaround, you can always slice the image data in a way you need.

from pixelmatch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.