Reading a 8bit Tif image from ArcMAP doesnt read well

German Ocampo <[email protected]>
Newsgroups gmane.comp.python.image
Message-ID <[email protected]>
Good morning

Im reading an 8bit image generated by ArcMap using PIL in windows, the
image load well without error messages but, when I try to extract the
values to a numpy array I got some lines of the image with value of
pixel 127 (greyscale) or rgb(0,0,0). When I open the image using GIMP
or arcmap  I could see that the image is complete.

Any idea of what is happening??

the code that I'm using for read the image is:

     from PIL import Image
     from PIL import TiffImagePlugin
    import numpy as np
    import sys
    im = Image.open(file_tif)
    values=np.zeros((size_y,size_x))
    mode=im.mode
    temp=list(im.getdata())
    cont=-1
    list_colors=[]
    for i in range(0,size_y):
        for j in range(0,size_x):
            cont+=1
            if mode=="RGB":
                color=temp[cont]
                print cont,temp[cont]
                if color in list_colors:
                    index=list_colors.index(color)
                    values[i][j]=index+1
                else:
                    list_colors.append(color)
                    values[i][j]=len(list_colors)
            else:
                values[i][j]=temp[cont]

Best regards

German
_______________________________________________
Image-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/image-sig
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.