Improvements to the generated difference image (#520) #1028
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.After
The "difference" image now highlights pixels with changes to their the alpha component.
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.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.