imgRampPng=imread('ramp-gray.png')
print (imgRampPng.shape) #(1, 255), that is right
print (imgRampPng.min(),imgRampPng.max()) #(0.0, 0.99607843)
print ()
imgGrayPng=imread('python-gray.png')
print (imgGrayPng.shape) #(128, 128, 3), *but I suppose it should
be (128, 128)*
print (imgGrayPng.min(),imgGrayPng.max()) #(0.0, 0.98823529)
print ()
Ch1=imgGrayPng[:,:,0]
Ch2=imgGrayPng[:,:,1]
Ch3=imgGrayPng[:,:,2]
print (Ch1.min(), Ch1.max()) #(0.0, 0.98823529)
print (Ch2.min(), Ch2.max()) #(0.0, 0.98823529)
print (Ch3.min(), Ch3.max()) #(0.0, 0.98823529) #that is to say,
Ch1/2/3 hold same data
print ()
[/code]
Did you read my answer from yesterday ? your python-gray.png uses a
color palette, the integer values stored in file are indexes to the
(RGB) values given in the palette. Matplotlib is doing right in
converting the indexes to the RGB values.
The color palette represents here the grayscale, that's why all channel
are equal. But the data is stored in the compact palette way.
imgRampPng=imread('ramp-gray.png')
print (imgRampPng.shape) #(1, 255), that is right
print (imgRampPng.min(),imgRampPng.max()) #(0.0, 0.99607843)
print ()
imgGrayPng=imread('python-gray.png')
print (imgGrayPng.shape) #(128, 128, 3), *but I suppose it should
be (128, 128)*
print (imgGrayPng.min(),imgGrayPng.max()) #(0.0, 0.98823529)
print ()
Ch1=imgGrayPng[:,:,0]
Ch2=imgGrayPng[:,:,1]
Ch3=imgGrayPng[:,:,2]
print (Ch1.min(), Ch1.max()) #(0.0, 0.98823529)
print (Ch2.min(), Ch2.max()) #(0.0, 0.98823529)
print (Ch3.min(), Ch3.max()) #(0.0, 0.98823529) #that is to say,
Ch1/2/3 hold same data
print ()
[/code]