I was curious about image processing with python, so I found this great library imageio, I tried to manipulate the pixels of a picture and save them in a new file, but i had some problems with the loops this is what the code looks like enter image description here and this the error that i Got ! IndexError: index 3507 is out of bounds for axis 0 with size 3507 the code :
# -*- coding: iso-8859-1 -*-
import imageio
import numpy as np
im = imageio.imread("JAFFRE009a.png")
taille=im.shape #taille is a tuple (Width,Height)
print taille # (4961,3507)
matrice_pixels=open("matrice.txt",'w')
for i in range(taille[1]):
line=""
for j in range(taille[0]):
line+=repr(im[i][j])
matrice_pixels.write(line+'\n')
matrice_pixels.close()