numpy empty image 1

numpy empty image

import numpy as np
img = np.zeros([100,100,3],dtype=np.uint8)
img.fill(255) # or img[:] = 255

# from https://stackoverflow.com/questions/10465747/how-to-create-a-white-image-in-python/10470485

Here is what the above code is Doing:
1. Create a numpy array of zeros with the shape of 100x100x3.
2. Fill the array with 255.
3. Convert the array to an image.

Similar Posts