[Image-SIG] MemoryError when i create a big image

Juanmi juanmiguel.sanchezacosta at gmail.com
Fri Mar 7 20:09:00 CET 2008


Lino thanks for you answer, you are right, I saw this in handbook:
-----------
"1"1-bit bilevel, stored with the leftmost pixel in the most significant
bit. 0 means black, 1 means white.
-----------
I have been testing, and on saving the image on the hard disk, it stores
with a bit per pixel, but loaded in memory use a byte per pixel.

if the image is black/white with bmp format, should not work PIL only with a
bit per pixel in memory?

thanks again.

On Fri, Mar 7, 2008 at 8:07 AM, Lino Mastrodomenico <
l.mastrodomenico at gmail.com> wrote:

> 2008/3/3, Juanmi <juanmiguel.sanchezacosta at gmail.com>:
> > I need create a big bmp image (b/n) with width 64000 pixels and
> height:48000
> > pixels, but when i try it, PIL return a memory error.
> > This image should have around 350MB so i dont understand the memory
> error.
>
> PIL uses one byte per pixel even for type '1' images, so this requires
> almost 3 GB of memory.
>
> > Someone can help me? Maybe is Windows?
> >
> > Code:
> >
> > import Image
> > white_img = Image.new ('1', (64000,48000),(1))
> > white_img.save('white.bmp')
>
> This works fine on my AMD64 GNU/Linux laptop. You simply need a 64 bit
> architecture and/or a better operating system.
>
> --
> Lino Mastrodomenico
> E-mail: l.mastrodomenico at gmail.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/image-sig/attachments/20080307/d9ee020e/attachment.htm 


More information about the Image-SIG mailing list