PIL JPEG Windows Problem
Bengt Richter
bokr at oz.net
Thu Oct 28 18:52:23 EDT 2004
On Thu, 28 Oct 2004 08:42:42 -0400, Steve Holden <steve at holdenweb.com> wrote:
>If nobody has a quick answer I'll go to the PIL list, but I'm having
>problems with PIL JPEG support on Windows, and figured someone on c.l.py
>might have solved this problem.
>
>I built the Cygwin PIL from source, and that works a treat.
>Unfortunately the Windows version (1.1.4 and 1.1.5b1) loaded using
>binary installers is giving
>
> File "/c/steve/website/hpgraphics.py", line 23, in ?
> File "C:\Python23\Lib\site-packages\PIL\ImageFont.py", line 115, in ?
> class FreeTypeFont:
> File "C:\Python23\Lib\site-packages\PIL\ImageFont.py", line 132, in
>FreeTypeFont
> def getmask(self, text, mode="", fill=Image.core.fill):
> File "C:\Python23\Lib\site-packages\PIL\Image.py", line 45, in
>__getattr__
> raise ImportError("The _imaging C module is not installed")
>ImportError: The _imaging C module is not installed
>
>When I import the _imaging module directly a dialog box informs me that
>libjpeg.dll can't be found, and I have confirmed that it isn't anywhere
>on the disk - I have a libjpeg.dll.a as part of cygwin, but I can't
>persuade myself this can be munged into suitable form. It would be nice
>if I were wrong ...
>
>The PIL docs do say something about having to add JPEG support, but
>unfortunately I can't find any information about adding *Windows* JPEG
>support.
>
I succeeded in building PIL from source on windows about two years ago.
I had to get jpeg and zlib (setup warns about security problem if it sees old zlib )
from the net and build them myself, and then tweak setup.py to pick them up. There's
notes in setup.py about it. E.g., from Imaging-1.1.3\setup.py :
----
# on windows, the build script expects to find both library files and
# include files in the directories below. tweak as necessary.
JPEGDIR = "../../kits/jpeg-6b"
ZLIBDIR = "../../kits/zlib-1.1.3"
# on windows, the following is used to control how and where to search
# for Tcl/Tk files. None enables automatic searching; to override, set
# this to a directory name
TCLROOT = None
----
IIRC I disabled some TCLROOT logic looking for tk.h, as I didn't have the latter on disk...
It might (or not ;-) tell you something useful if you go into <something>\Imaging-x.x.x
and type setup.py -n install, and see what goes by with zlib and jpeg in it.
It will want to build using cl.exe I think, so that needs to be available in the environment
you do it for real in, and presumably a cl.exe compatible with how your python was built
(I haven't got MSVC++7, so I can't tell you about that).
HTH
Can probably reconstruct if you get stuck. I can't find a build script for what I did
for jpeg and zlib right now though ;-( There does seem to be a .dsw MSC++ workspace project
for the jpeg though...
Regards,
Bengt Richter
More information about the Python-list
mailing list