Re: packing greyscale values

2008-02-11 Thread John Machin
On Feb 11, 9:11 pm, Peter Otten <[EMAIL PROTECTED]> wrote: > jimgardener wrote: > > hi > > i am getting value of a pixel of a greyscale image using PIL's > > image.getdata and need to pack it as an int as below > > > ie greyvalues > > 127 , 56 , 135 , 99 , 102 , 101 , 146 , 112 , 155 , 154 , 112 ,

Re: packing greyscale values

2008-02-11 Thread jimgardener
>>Are you sure the lists you give belong to the same image? the greyvalues list was printed out by python script on a 3X4 sampleimage i made to check this im=Image.open("mypicgrey.jpg") pixels=im.getdata() for pix in pixels: print pix whereas the integers in the second list were from java cod

Re: packing greyscale values

2008-02-11 Thread Peter Otten
jimgardener wrote: > hi > i am getting value of a pixel of a greyscale image using PIL's > image.getdata and need to pack it as an int as below > > ie greyvalues > 127 , 56 , 135 , 99 , 102 , 101 , 146 , 112 , 155 , 154 , 112 , 169 > > should become > -4473925, -8289919, -4144960, -5789785, -559

Re: packing greyscale values

2008-02-11 Thread bearophileHUGS
Diez B. Roggisch: > Then build up the mapping. Not elegant, but works. For the OP: note that a list suffices, no dict needed. Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: packing greyscale values

2008-02-11 Thread Diez B. Roggisch
jimgardener wrote: > hi > i am getting value of a pixel of a greyscale image using PIL's > image.getdata and need to pack it as an int as below > > ie greyvalues > 127 , 56 , 135 , 99 , 102 , 101 , 146 , 112 , 155 , 154 , 112 , 169 > > should become > -4473925, -8289919, -4144960, -5789785, -559

packing greyscale values

2008-02-10 Thread jimgardener
hi i am getting value of a pixel of a greyscale image using PIL's image.getdata and need to pack it as an int as below ie greyvalues 127 , 56 , 135 , 99 , 102 , 101 , 146 , 112 , 155 , 154 , 112 , 169 should become -4473925, -8289919, -4144960, -5789785, -5592406, -5658199 ,-3684409, -5131855, -3