python - Image processing: Trying to make a photo negative? -
i understand make image negative, have change rgb values current value being subtracted 255.
what wrong following code?
def negative(im): height=len(im) width = len(im[0]) row in range(height): col in range(width): red = im[row][col][0] - 255 green = im[row][col][1] - 255 blue = im[row][col][2] - 255 im[row][col]=[red,green,blue] return im
it returns error "tclerror: can't parse color "#-1d-c-2""
your problem getting negative numbers. think should doing 255 - x
rather x - 255
Comments
Post a Comment