Hey, guys! Newbie here. =) I'm trying to return an image that contains n^2 full size copies of my original image tiled, that makes an n-by-n square. I've been working on this for the past couple days and I am stuck. It's giving me an "image index out of range" error and I'm not even sure my code will tile anything. Help?
(Oh, and if my code doesn't show up tabbed in the correct spots, my orginal code has appropriate indentation. That I'm sure of.)
import Image
def tile(img):
w,h=img.size
x=Image.new("RGB", (w*2, h*2))
m=0
n=0
for r in range (n^2):
if r==0:
m==0
if r==1:
m=w
for i in range(w):
if r==0:
n==0
if r==0:
n==h
for j in range (h):
p=img.getpixel((i,j))
x.putpixel((m, n), p)
n=n+1
m=m+1
return x
def main():
filename=raw_input ("Gimme a picture.")
n=raw_input ("How many times would you like it tiled?")
img=Image.open(filename)
tiled=tile(img)
tiled.show()
main()