def setUp(self):
		"""
		steve@solaris:~/code/mactorii$ md5sum blueships.jpg 
		9c5e36768e6dad37b17244eb54ca9b9d  blueships.jpg
		steve@solaris:~/code/mactorii$ md5sum hiero.jpg 
		1aa200df65ff0d99ffc2b9543963bed4  hiero.jpg
		"""
		self.wi=[]
		self.wi.append(wavelet.open("bluexmas2k2.jpg"))
		self.wi.append(wavelet.open("hiero.jpg"))
Exemple #2
0
	def load_file(self,file):
		"""loads the files given in the command line"""
		
		#print "processing file: %s"%(file)
		
		try:
			wi = wavelet.open(file)
		except:
			print "can't load file: %s"%(file)
			return
			
		sig = wi.get_signature()
		
		# get the pre-loaded image from wavelet
		im = wi.im
		w,h = im.size

		# resize the image so the smallest dimension is config.crop_size	
		s=0
		if w > h:
			s = 1.0*config.crop_size/h
		else:
			s = 1.0*config.crop_size/w
		
		w = int(w*s*1.3)
		h = int(h*s*1.3)

		im=im.resize((w, h), Image.ANTIALIAS)
		
		# crop out the centre crop_size square to use a thumbnail
		midx = w/2
		midy = h/2
		box = (midx-config.crop_size/2, midy-config.crop_size/2, midx+config.crop_size/2, midy+config.crop_size/2)
		im=im.crop(box)
		
		# make a pyglet image out of it
		psurf = image_to_psurf(im)
		
		# add to our dictionary
		self.images[ file ] = {'surface':psurf, 'signature':sig, 'size':wi.size, 'cluster key':0}