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)
帮助? :)
答案 0 :(得分:0)
我不知道你使用的库,但我认为getRed()
将返回整数,而不是字符串。代替:
if pxRed == '255':
尝试比较整数:
if pxRed == 255: