PIL JPEG Windows Problem

S

Steve Holden

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.

regards
Steve
 
B

Bengt Richter

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
 
A

Ann

Steve Holden said:
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

<snip>

I am a newbie, but I installed python about 2 months ago, from binaries
and added PIL maybe a month ago with no problems on Win XP Pro. I refuse
to compile anything.
The python log file has no 'jpg' or 'jpeg' files, but the
PIL log file has these two:
200 File Copy: C:\Python23\Lib\site-packages\PIL\JpegImagePlugin.py
200 File Copy: C:\Python23\Lib\site-packages\PIL\JpegImagePlugin.pyc
I do not have libjpeg.dll
HTH
 
S

Steve Holden

<unsnip :)>

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
I am a newbie, but I installed python about 2 months ago, from binaries
and added PIL maybe a month ago with no problems on Win XP Pro. I refuse
to compile anything.
The python log file has no 'jpg' or 'jpeg' files, but the
PIL log file has these two:
200 File Copy: C:\Python23\Lib\site-packages\PIL\JpegImagePlugin.py
200 File Copy: C:\Python23\Lib\site-packages\PIL\JpegImagePlugin.pyc
I do not have libjpeg.dll
HTH

Thanks for the input, but it doesn't, unfortunately, help - I have those
files too. I presume you are using PIL 1.1.4?

I thought it might be a 1.1.5b1-specific thing, but sadly a de-install
followed by a re-install of 1.1.4 gives me the same error - a dialog box
appears telling me that libjpeg.dll can't be found in any of an umber of
directories (not surprising, since there is no such file on my disk).

I thought I'd fixed the problem by copying jpeg62.dll from GTK 2.0 and
renaming it as libjpeg.dll, but unfortunately Windows then started
complaining about the absence of libz.dll (and a copy of libz.pyd
definitely won;t do the trick).

So I'll copy this to the PIL support list and see what the gurus have to
say. I'm wondering if there could possibly be any interaction between
the Cygwin and Windows versions, since both are now loaded on the same
machine. Bit stumped here ... I don't remember PIL being so
temperamental before, and it's working beautifully under Cygwin.

regards
Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top