The function is called sepia and it is supposed to call grayscale first.
Here is what I have so far, any suggestions?
import Image
def sepia (image, grayscale):
if red < 63:
red = int(red * 1.1)
blue = int(blue * 0.9)
elif red < 192:
red = int(red * 1.15)
blue = int(blue * 0.85)
else:
red = min(int(red * 1.08), 255)
blue = int(blue * 0.93)
def grayscale(image):
for y in xrange(image.getHeight()):
for x in xrange(image.getWidth()):
(r, g, B)/> = image.getPixel(x, y)
r = int(r * 0.299)
g = int(g * 0.587)
b = int(b * 0.114)
lum = r + g + b
image.setPixel(x, y, (lum, lum, lum))
def main(filename = "smokey.gif"):
image = Image(smokey.gif)
print "Close the image window to continue."
image.draw()
sepia(image)
print "Close the image window to quit."
image.draw()
main()
The error I am getting is
Traceback (most recent call last):
File "C:\Python27\7_8", line 40, in <module>
main()
File "C:\Python27\7_8", line 34, in main
image = Image(smokey.gif)
NameError: global name 'smokey' is not defined
which I am not sure why- I have the file smokey saved in my working directory.
Thanks in advance for any help.
Kkasp

New Topic/Question
Reply


MultiQuote



|