Skip to content

Instantly share code, notes, and snippets.

@marcostolosa
Created July 11, 2018 17:22
Show Gist options
  • Save marcostolosa/30ed5334ca41db875acad6e1d27025b2 to your computer and use it in GitHub Desktop.
Save marcostolosa/30ed5334ca41db875acad6e1d27025b2 to your computer and use it in GitHub Desktop.
Diff PNG Images
from PIL import Image
i1 = Image.open("A.png")
i2 = Image.open("B.png")
img = Image.new('RGB', i1.size)
p1 = i1.load()
p2 = i2.load()
pnew = img.load()
for i in range(i1.size[0]):
for j in range(i1.size[1]):
if p1[i,j] != p2[i,j]:
pnew[i,j] = (255,255,255)
img.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment