我正在编写一个函数来转换并将图像显示为负数,当我调用该函数时,我收到此错误消息:
Traceback (most recent call last):
File "C:/Users/User/PycharmProjects/Librophyton/Procdeimagenes/test.py",line 32, in <module>
makeNegative(dude)
File "C:\Python34\lib\ImageProcess.py", line 16, in makeNegative
old = FileImage(imageFile)
File "C:\Python34\lib\cImage.py", line 398, in __init__
super(FileImage, self).__init__(fname = thefile)
File "C:\Python34\lib\cImage.py", line 241, in __init__
self.loadImage(fname)
File "C:\Python34\lib\cImage.py", line 270, in loadTkImage
sufstart = fname.rfind('.')
AttributeError: 'FileImage' object has no attribute 'rfind'
这是功能:
def makeNegative(imageFile):
window = ImageWin("Proceso de imagen", 1000-100, 900)
old = FileImage(imageFile)
old.draw(window)
window.exitOnClick()
w = old.getWidth()
h = old.getHeight()
new = EmptyImage(w,h)
for row in range(h):
for col in range(w):
pixelviejo = old.getPixel(col,row)
pixelnuevo = pixelNeg(pixelviejo)
new.setPixel(col, row, pixelnuevo)
new.setPosition(w+1, 0)
new.draw(window)
window.exitOnClick()
以下是功能调用:
dude = FileImage("factores_de_conversion.gif" )
makeNegative(dude)
知道如何解决这个问题吗?或者我该如何修改模块?