I'm trying to make an image with a random color for each pixel then print open a window to see the image.
import PIL, random
import matplotlib.pyplot as plt # single use of plt is commented out
import os.path
import PIL.ImageDraw
from PIL import Image, ImageDraw, ImageFilter
im = Image.new("RGB", (300,300))
for r in range(0,300):
for c in range(0,300):
re = random.randint(0, 255)
gr = random.randint(0, 255)
bl = random.randint(0, 255)
im[r][c]=[re,gr,bl]
im.show()
14 bl = random.randint(0, 255)
---> 15 im[r][c]=[re,gr,bl]
16 im.show()
TypeError: 'Image' object does not support indexing
Aucun commentaire:
Enregistrer un commentaire