2
嗨,我試圖玩弄我的代碼,並不能真正弄清楚如何將我的代碼的一部分變成灰度。這是我的代碼:如何在JES中創建圖片灰度的一部分?
def grayScale(picture):
xstop=getWidth(picture)/2
ystop=getHeight(picture)/2
for x in range(0,xstop):
for y in range(0,ystop):
oldpixel= getPixel(picture,x,y)
colour=getColor(oldpixel)
newColor=(getRed(oldpixel),getGreen(oldpixel),getBlue(oldpixel))/3
setColor(picture,(newColor,newColor,newColor))
repaint(picture)
nP=makePicture(pickAFile())
show(nP)
任何幫助表示讚賞,真的很難明白這一點。再次感謝你的幫助!所示
錯誤:
灰度(NP) 錯誤是: '元組' 和 'INT'
不適當的參數類型。 嘗試使用無效類型的參數調用函數。這意味着你做了一些事情,比如試圖將一個字符串傳遞給一個期待整數的方法。 請檢查線路8 /用戶/ enochphan /桌面/測試