Python imaging Library - compares two images and highlights differences on the second image

Below is the current working code in python using PIL for highlighting the difference between the two images. But rest of the images is blacken.

Currently i want to show the background as well along with the highlighted image.

Is there anyway i can keep the show the background lighter and just highlight the differences.

from PIL import Image, ImageChops
point_table = ([0] + ([255] * 255))

def black_or_b(a, b):
    diff = ImageChops.difference(a, b)
    diff = diff.convert('L')
    # diff = diff.point(point_table)
    new = diff.convert('RGB')
    new.paste(b, mask=diff)
    return new

a ='i1.png')
b ='i2.png')
c = black_or_b(a, b)'diff.png')


This question and all comments follow the "Attribution Required."

All Answers

Answers Loading...
Leave a Reply
You must be logged in to post a answer.
About the author