嘿,我不知道如何让 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)
帮助?!:)