Example #1
0
	def read_available(self, input_dir):
		glob_1px = input_dir + "/*"
		for infile in glob.glob(glob_1px):
			(width, height, data) = imagelib.read(infile)
			if width != 1 or height != 1:
				raise StdError("%s should be a 1px image" % (infile))
			print (infile + ": " + str(data[0,0]))
			self.append( Photo(infile, data[0,0] ))
Example #2
0
	def __init__(self, image=None, size=None):
		self.array = {}
		self.image = image
		if image:
			(self.width, self.height, pix_array) = imagelib.read(self.image)
			for pix in self.iter_pix():
				self.array[pix] = Pixel(pix_array[pix])
		else:
			self.width = size[0]
			self.height = size[1]
			for pix in self.iter_pix():
				self.array[pix] = Pixel()