0
嘿, 我不知道如何讓Jython意識到像素是(0,0,0)或(255,255,255)。基本上我只是試圖將所有白色像素轉換爲黑色,反之亦然。 以下是我的沙發:S更改黑色像素爲白色,反之亦然
def changeBlackWhite(picture):
for x in range(getWidth(picture)):
for y in range(getHeight(picture)):
px = getPixel(picture, x, y)
pxRed = getRed(px)
pxBlue = getBlue(px)
pxGreen = getGreen(px)
if pxRed == '255':
if pxBlue == '255':
if pxGreen == '255':
setRed(px, 0)
setBlue(px, 0)
setGreen(px, 0)
幫助? :)