Я пытаюсь создать 3 х 3 из 9 изображений и меняя цвет каждого изображения. Мой код ниже не меняет цвета. Это создает 3 х 3, но все одного цвета. Помощь очень ценится, спасибо!
image = Image.open("image.gif")
image = image.convert('RGB')
images=[]
width,height=image.size
pixels=image.load()
for x in range(width):
for y in range(height):
current_color = image.getpixel((x,y))
r, g, b = image.getpixel((x,y))
new_color = int(r*0.1),int(g*0.5),int(b*.9)
image.putpixel((x,y),new_color)
images.append(image)
##create 3 x 3 of images
first_image=images[0]
contact_sheet=PIL.Image.new(first_image.mode, (first_image.width*3,first_image.height*3))
x=0
y=0
for img in images:
if x+first_image.width == contact_sheet.width:
x=0
y=y+first_image.height
else:
x=x+first_image.width
# resize and display the contact sheet
contact_sheet = contact_sheet.resize((int(contact_sheet.width/2),int(contact_sheet.height/2) ))
display(contact_sheet)