I have two similar masked images with transparent backgrounds. I want to get image difference and expect it as low value as images are similar.
But the result shows huge difference over transparent area which looks just same.
(white means diff)
diff_res = ImageChops.difference(lenna1, lenna2).convert('RGB')
I checked lenna1, lenna2 image difference on some website and it says images are just same except small diffs on boundaries.
I then suspected alpha channel value and converted lenna1, lenna2 into 'RGB'. and it shows one's background as black but the other's as white.
lenna1 = Image.open('lenna1.png')
lenna2 = Image.open('lenna2.png')
converted_lenna1 = lenna1.convert('RGB')
converted_lenna2 = lenna2.convert('RGB')
converted_lenna1 converted_lenna2
Now I know convert() makes transparent area into black as default. But I still don't get it.
- Why there's image difference between transparent area?
- Why some transparent image became white and How can I make my own "will be white" transparent image?
*I also tested with same alpha level using .putalpha()
Thank you for reading this question.