Q:

Write a NumPy program to create a white image of size 512x256

0

Write a NumPy program to create a white image of size 512x256.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

from PIL import Image
import numpy as np

a = np.full((512, 256, 3), 255, dtype=np.uint8)
image = Image.fromarray(a, "RGB")
image.save("white.png", "PNG")

Sample Output:

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now