I got this warning but I cannot fix it. Code works.
Warning: Lossy conversion from float64 to uint8. Range [0, 1]. Convert image to uint8 prior to saving to suppress this warning.
from skimage.io import imread, imshow, imsave
img_grey = imread('C:/Lawn.png', as_gray=True)
imsave('Lawn22.png', img_grey)
img = imread('C:/Lawn.png')
imshow(img)
You need after reading image convert float64 to type uint8
like below for removing this warning message with this code:
img_grey = img_grey / img_grey.max() #normalizes img_grey in range 0 - 255
img_grey = 255 * img_grey
img_grey = img_grey.astype(np.uint8)
whole code without warning message:
from skimage.io import imread, imshow, imsave
img_grey = imread('C:/Lawn.png', as_gray=True)
# convert image to uint8
img_grey = img_grey / img_grey.max() #normalizes img_grey in range 0 - 255
img_grey = 255 * img_grey
img_grey = img_grey.astype(np.uint8)
imsave('Lawn22.png', img_grey)
img = imread('C:/Lawn.png')
imshow(img_grey)