You are on page 1of 1

def getArtifiedPixel(p):

#This is an ordered list of tuples. The first value is the


#upper range value to compare against. The second value is
#the value to replace the original pixel with.
colorSubstitutionTable = [(64,31),(128,95),(192,159),(256,223)]
for tuple in colorSubstitutionTable:
#If this pixel's value is less than the first value
#in the tuple, return the second value
if(p < tuple[0]):
return tuple[1]
return p

def Artify(pic):
pixels = getPixels(pic)
for p in pixels:
r = getRed(p)
g = getGreen(p)
b = getBlue(p)
setRed(p,getArtifiedPixel(r))
setGreen(p,getArtifiedPixel(g))
setBlue(p,getArtifiedPixel(b))
return pic

You might also like