PIL(LOW) - What am I missing?

Gary Herron gherron at digipen.edu
Thu Mar 26 00:23:54 EDT 2015


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




More information about the Python-list mailing list