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)
h,w=diff.size
new = diff.convert('RGB')
new.paste(b, mask=diff)
return new
a = Image.open('i1.png')
b = Image.open('i2.png')
c = black_or_b(a, b)
c.save('diff.png')
!https://drive.google.com/file/d/0BylgVQ7RN4ZhTUtUU1hmc1FUVlE/view?usp=sharing
This question and all comments follow the
"Attribution Required."
Similar questions
- Excel compares the two columns and highlights them when they are found
- How to use Python imaging library to close images displayed to users?
- Python imaging Library - text rendering
- Reportlab and python imaging library images come from memory problems
- Use Python imaging Library (PIL) to create images by inputting pixel values
- More similar questions >>
All Answers
Leave a Reply