Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

if len(i1.getbands()) == 1

from PIL import Image

i1 = Image.open('./image_1.png')

for i in range(18):
	i2 = Image.open('./image_%s.png'% i)
	pairs = zip(i1.getdata(), i2.getdata())
	if len(i1.getbands()) == 1:
		# for gray-scale jpegs
		dif = sum(abs(p1-p2) for p1,p2 in pairs)
	else:
		dif = sum(abs(c1-c2) for p1,p2 in pairs for c1,c2 in zip(p1,p2))
	ncomponents = i1.size[0] * i1.size[1] * 3
	print ("Difference (percentage):", (dif / 255.0 * 100) / ncomponents)
Comment

PREVIOUS NEXT
Code Example
Python :: rotate an image python keras 
Python :: how to do welcome in bubble letters in python 
Python :: i want to get only first record of each user in pandas 
Python :: django template child data in nested loop 
Python :: numpy convolution stride tricks 
Python :: install sort 
Python :: python code to display a grid of data table 
Python :: python-wordpress-xmlrpc get post id 
Python :: pyqt message box set detailed text 
Python :: student notebook (finish), INB (finish), Food and Fitness log (log necessary), debate speech (finish) 
Python :: find that are not images in the entire images folder. 
Python :: mo.group() separated with spaces instead of commas python 
Python :: python update python 
Python :: apache virtual host django wsgi 
Python :: defining a class in python 
Python :: Python ValueError in strptime() 
Python :: encrypt 
Python :: latex new command with arguments 
Python :: fetchall in python sqilite3 
Python :: django filter form view 
Python :: telegram bot python 
Python :: pandas to_csv adds unnamed column 
Python :: time, date 
Python :: change legend facecolor 
Python :: appropriate graph for dataset visualization 
Python :: frame work in turtle module 
Python :: Dataframe with defined shape filled with 0 
Python :: python setup specify c++ version 
Python :: how to drag a box on your screen python 
Python :: accessing element from csv file in python 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =