from matplotlib import image, numpy, pyplot as mplot
class Image:
def __init__(self, data):
self.data = numpy.array(data[:,:,0:3]).astype('uint8')
def __repr__(self):
image.imsave("temp.png", self.data)
salvus.file("temp.png")
return ""
def __add__(self, other):
return Image(numpy.bitwise_xor(self.data, other.data) )
def size(self):
return (len(self.data), len(self.data[0]))
def RandomImage(m, n):
return Image(numpy.random.random_integers(255, size=(m,n,3)) )
def LoadImage(filename):
tmp = image.imread(filename)
return Image(image.imread(filename))