How to create a white image in Python?

Every color in an image is represented by one byte. So to create an image array, you should set it's dtype to uint8.

And, you don't need for-loop to set every elements to 255, you can use fill() method or slice index:

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

Easy! Check the below Code:

whiteFrame = 255 * np.ones((1000,1000,3), np.uint8)

255 is the color for filling the bytes.

1000, 1000 is the size of the image.

3 is the color channel for the image.

And unit8 is the type

Goodluck