PIL(LOW) - What am I missing?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

PIL(LOW) - What am I missing?

kai.peters@gmail.com

I create an image as per:

    img  = Image.new('1', (1024, 1280), 1)
       
I then draw on it and do:

    imagedata = list(img.getdata())
    print len(imagedata)

This gives me 1228800 instead of the expected 1310720 (1024 * 1280)
- any ideas what I am missing?

As always, any help much appreciated.

Kai


Reply | Threaded
Open this post in threaded view
|

PIL(LOW) - What am I missing?

Gary Herron-2
On 03/25/2015 08:54 PM, kai.peters at gmail.com wrote:

> I create an image as per:
>
>      img  = Image.new('1', (1024, 1280), 1)
>
> I then draw on it and do:
>
>      imagedata = list(img.getdata())
>      print len(imagedata)
>
> This gives me 1228800 instead of the expected 1310720 (1024 * 1280)
> - any ideas what I am missing?
>
> As always, any help much appreciated.
>
> Kai

Are you sure?

Both Python2 and Python3 give me the expected 1310720,

I'm running PILLOW version 2.6.1 on Linux (with both Python 3.4.2 and
Python 2.7.8).

 >>> from PIL import Image
 >>> img  = Image.new('1', (1024, 1280), 1)
 >>> imagedata = list(img.getdata())
 >>> print len(imagedata)
1310720



--
Dr. Gary Herron
Department of Computer Science
DigiPen Institute of Technology
(425) 895-4418



Reply | Threaded
Open this post in threaded view
|

PIL(LOW) - What am I missing?

kai.peters@gmail.com
In reply to this post by kai.peters@gmail.com
On Wednesday, 25 March 2015 20:54:21 UTC-7, kai.p... at gmail.com  wrote:

> I create an image as per:
>
>     img  = Image.new('1', (1024, 1280), 1)
>
> I then draw on it and do:
>
>     imagedata = list(img.getdata())
>     print len(imagedata)
>
> This gives me 1228800 instead of the expected 1310720 (1024 * 1280)
> - any ideas what I am missing?


Please disregard - typo after a long night :(
>
> As always, any help much appreciated.
>
> Kai