TypeError: Cannot handle this data type: (1, 1, 3),

The error message seems to be complaining about the shape, but it is really about the data type. Multiplying by 255 and then changing to uint8 fixed the problem for me:

random_array = np.random.random_sample(content_array.shape) * 255
random_array = random_array.astype(np.uint8)
random_image = Image.fromarray(random_array)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)