hello I have an error that appears on python it’s ‘tuple’ has no attribute ‘size’. can you help me, (it’s with the PIL module)
from PIL import Image
image1 = Image.open(".\christmas.png")
L, H = image1.size
image2 = Image.new(“RGB”,(L,H))
for y in range(H):
for x in range(L):
pixel = image1.getpixel((x,y))
r = pixel[0]
v = pixel[1]
b = pixel[2]
g = int( ®)
h = int( ®)
i = int( (v))
image2.putpixel((x,y),(g,h,i))
Partie 1
im_size = image2.size
# Define box inside image
left = 0
top = 0
width = 539
height =179
# Create Box
box = (left, top, left+width, top+height)
# Crop Image
area1= image2.crop(box)
area1.show()
#image 2
im_size = image2.size
left2 = 0
top2 =179
width2 = 539
height2 =179
box2 = (left2, top2, left2+width2, top2+height2)
area2 =image2.crop(box2)
area2 = area2.rotate(180)
area2.show()
#image 3
im_size = image2.size
left3 = 0
top3 = 358
width3 = 539
height3 =179
box3 = (left3, top3, left3 + width3, top3 + height3)
area3 = image2.crop(box3)
area3.show()
size = 530
area1 = area1.size
print (area1.size)
#creates a new empty image, RGB mode, and size 400 by 400.
new_im = Image.new(‘RGB’, (2156,2*im_size[1]))
new_im.paste(area1, (0,0))
new_im.paste(area2, (0,im_size[1]))
new_im.paste(area3, (1000,0))
new_im.save(“Modis_2008015_1435.png”, “PNG”)
new_im.show()