Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added fixtures/7a.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added fixtures/7b.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added fixtures/7diff.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 2 additions & 11 deletions pixelmatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,10 @@ def pixelmatch(img1, img2, width: int, height: int, output=None, options=None):
else:
options = DEFAULT_OPTIONS

# check if images are identical
image_len = width * height
identical = True

for i in range(image_len):
if img1[i] != img2[i]:
identical = False
break

# fast path if identical
if identical:
if img1 == img2:
if output and not options["diff_mask"]:
for i in range(image_len):
for i in range(width * height):
draw_gray_pixel(img1, 4 * i, options["alpha"], output)

return 0
Expand Down
1 change: 1 addition & 0 deletions test_pixelmatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def pil_to_flatten_data(img):
["5a", "5b", "5diff", OPTIONS, 0],
["6a", "6b", "6diff", OPTIONS, 51],
["6a", "6a", "6empty", {"threshold": 0}, 0],
["7a", "7b", "7diff", OPTIONS, 9856],
]


Expand Down