I am trying to load and display a bmp image in python.
I have tried several modules now (PIL, skimage.io, matplotlib) but the image gets displayed wrongly every time.
This is the original picture and this is how it looks like after loading and displaying it in python. (The original image gets converted to png when uploaded here).
Here is the most recent code I am using:
from skimage import io
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)
image = io.imread('107.bmp')
io.imshow(image)
plt.show()
It looks like there is a problem with the way I am importing the bmp file. When I print the first column of the loaded image with print(image[:,0]) the resulting (494,) array already contains white 255 valued pixels that should only occur in the middle of the image somewhere around image[:, 300]. So far I could not find any options for io.imread() that help solving this problem.
What am I doing wrong? How can I load the bmp image with the correct order of columns?
The original bmp image gets displayed correctly when I open it in the default windows photos app or paint.
I am using python 3.8.5 and scikit-image 0.17.2.