[Image-SIG] General questions about using PIL in a Py2exe project

Werner F. Bruhin werner.bruhin at free.fr
Mon Oct 25 20:04:13 CEST 2010


Hi Malcolm,

On 25/10/2010 18:33, python at bdurham.com wrote:
> We're thinking about using PIL (Python Imaging Library) in a project.
> Before we start down this path, I'm wondering if anyone can give me a
> rough estimate how much disk space the PIL package adds to a
> distribution and how difficult is it to distribute PIL as part of py2exe
> project?
> Background: We're using Python 2.7 32-bit for Windows). We're very
> familiar with py2exe. We are new to the PIL library.
I use it for some time with Py 2.5 and Py 2.6 on Windows, haven't moved 
to Py 2.7 yet.  Do not recall any problems when using it in relation to 
py2exe.

I use the "zipfile" option in py2exe, so the additional size is about 
500kb un-compressed with my usage(i.e. what I see in in zipfile/pil, see 
below for the "import's" I use).  Looking at PIL in site-packages this 
could go up to about 1.6 Mb.

In the setup.py I don't do anything special but in my code using PIL I 
have the following lines:

import PIL.Image as Image
import PIL.PngImagePlugin
import PIL.GifImagePlugin
import PIL.JpegImagePlugin
import PIL.BmpImagePlugin
Image._initialized=2

See also here:
http://www.py2exe.org/index.cgi/py2exeAndPIL

Hope this helps
Werner



More information about the Image-SIG mailing list