I am trying to create a grayscale image from an array of values that range from 0 to 1. here is an example of two of the arrays I have.
[[0.48 0.4 0.56 0.32 0.52]
[0.36 0.56 0.56 0.68 0.56]
[0.32 0.72 0.88 0.44 0.56]
[0.56 0.64 0.76 0.52 0.48]
[0.32 0.88 0.56 0.52 0.4 ]]
[[0.33333333 0.22222222 0.33333333]
[0.22222222 0.44444444 0.11111111]
[0.44444444 0.11111111 0.11111111]]
the shape of the array is always a square and the the amount that the values deviate from 0.5 varies. I more or less want values of 1 to be white and 0 to be black. Is there a relatively simple way to do this using a module such as matplotlib or pillow? (it doesn't have to be one of those two).
I have tried following some tutorials, but they all used hexadecimal value lists or integer values and don't understand the method enough to make them work with floats.

