Convert image from float64 to uint8 makes the image look darker

From the documentation of skimage.img_as_ubyte that you linked:

Negative input values will be clipped. Positive values are scaled between 0 and 255.

Since your images are in the range [-1,1], half of the data will be set to 0, which is why stuff looks darker. Try first scaling your image to a positive-only range, for example by adding 1 to it, before calling skimage.img_as_ubyte.


I fix this warning by using,

import numpy as np
import imageio

# suppose that img's dtype is 'float64'
img_uint8 = img.astype(np.uint8)
# and then
imageio.imwrite('filename.jpg', img_uint8)

That's it!