Skip to content

Prevent diff to be generated if threashold not reached #112

Description

@bluepioupiou

Hi,

I use pixelmatch to compare the whole bunch of screenshots i've been taking for each version of my product (approx 300 screenshots)
I use the binary to test each new screenshots against the previous one. But even if there is no differences (or if the diff threshold ins't reach), I still have a diff file generated which make the tester job quite difficult since he has to go through 300 files, even if there is no différence at all.

Can't you prevent the diff file to be writen if the threshold is not reached ?

Activity

  1. mourner commented on Apr 25, 2022

    @mourner
    Member

    Aren't you able to control this on your side? Run pixelmatch without diff, then run it again if there are differences above the threshold (which shouldn't happen often in tests, so performance isn't a concern)?

  2. bluepioupiou commented on Apr 25, 2022

    @bluepioupiou
    Author

    It could be a workaround indeed. But even with this, how can I tell the diff between the two doff files ?

    AndI found it a bit heavy and would prefer if the tool don't generate a file to show that there is no diff...

  3. mourner commented on Oct 6, 2026

    @mourner
    Member

    I'll close this — thinking more about this, I'd rather keep the CLI simple and predictable. E.g. if it skipped writing the diff when there are no differences, an old diff file from a previous run would stay around and look like the current result — non-obvious behavior. For workflows like the above, it's better to use the library directly and build your own scripts for convenience (thankfully that's easy enough today with LLMs).

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions