The colors are inverted, that is, each pixel color [r, g, b] displayed as [255 - r, 255 - g, 255 - b] .
This may have something to do with the type of image data you get in step 2. After resizing the image, do the following:
image = image.astype(np.uint8)
source share