Percentage difference between images: Difference between revisions

m (Fix Perl 6 -> Raku links)
Line 1,254:
 
=={{header|Python}}==
You must install the [https://pillow.readthedocs.io/ Python Imaging Library] to use this example. [https://pypi.org/project/Pillow/ Install with pip] : pip install Pillow
 
{{works with|python version 3.x}}
<lang python>from PIL import Image
 
i1 = Image.open("image1.jpg")
Line 1,272:
 
ncomponents = i1.size[0] * i1.size[1] * 3
print ("Difference (percentage):", (dif / 255.0 * 100) / ncomponents)</lang>
 
{{works with|python version 2.x}}
Anonymous user