여기 새내기. =) 나는 이미지를 반전 시도했지만 오류가 있고 난 몰라 왜 :/파이썬 오류 : IndexError : 이미지 색인이 범위를 벗어났습니다 (im.putpixel)
오류 :
Traceback (most recent call last):
File "C:/Users/Florian/Documents/ISN/S10/défi11.py", line 10, in <module>
im.putpixel((x,600-y),(p[0],p[1],p[2]))
File "C:\Python27\lib\site-packages\PIL\Image.py", line 1267, in putpixel
return self.im.putpixel(xy, value)
IndexError: image index out of range
강령 :
# -*- coding: cp1252 -*-
from PIL import Image
im=Image.open("H:\Belem.png")
L,H=im.size
for y in range(H):
for x in range(L):
p=im.getpixel((x,y))
im.putpixel((x,600-y),(p[0],p[1],p[2]))
im.save("H:\defi11.png")
600은 어디에서 왔습니까? 왜 'H-1-y'를 쓰지 않는거야? – amaurea