Skip to content

Conversation

CraigSiemens
Copy link

@CraigSiemens CraigSiemens commented Sep 25, 2025

This PR improves the generated difference image to make differences much clearer in cases where he alpha component changes or there's only a subtle change in color.

Examples

All the images below contain the "reference" "failure" and "difference" images from one test run.

Alpha only changes

The "reference" is a transparent image containing the word "Hello"
The "failure" is a transparent image with the same size containing the word "World"

Before

The "difference" image is all black because the alpha component is not considered by the difference blend mode.

before

After

The "difference" image now highlights pixels with changes to their the alpha component.

after

Subtle color changes

The "reference" image is the color Color(white: 128.0 / 255.0)
The "failure" image adds the text "Changed" with the foreground style Color(white: 129.0 / 255.0)

Before

The "difference" appears all black. The text is so close to the background color in the "failure", the "difference" has the color Color(white: 1.0 / 255.0) which not perceptible. You need to adjust the levels in an image editor to really make them visible.

before

After

The "difference" image now clearly shows the difference by normalizing the difference values in the image based on the max component difference per pixel. White is the most different pixel in the image, and black is unchanged pixels.

after

- now shows differences when only the alpha component changes
- normalizes the difference values to improve contrast in the image
- falls back to using the difference blend mode when the image size has changed
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

Successfully merging this pull request may close these issues.

Difference image doesn't show difference in opacity.
1 participant