By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,730 Members | 1,153 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,730 IT Pros & Developers. It's quick & easy.

PIL JPEG Windows Problem

P: n/a
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
--
http://www.holdenweb.com
http://pydish.holdenweb.com
Holden Web LLC +1 800 494 3119
Jul 18 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On Thu, 28 Oct 2004 08:42:42 -0400, Steve Holden <st***@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
Jul 18 '05 #2

P: n/a
Ann

"Steve Holden" <st***@holdenweb.com> wrote in message
news:6U5gd.19857$SW3.18915@fed1read01...
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
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
--
http://www.holdenweb.com
http://pydish.holdenweb.com
Holden Web LLC +1 800 494 3119

Jul 18 '05 #3

P: n/a
Ann wrote:
"Steve Holden" <st***@holdenweb.com> wrote in message
news:6U5gd.19857$SW3.18915@fed1read01...
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

<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

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.


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
--
http://www.holdenweb.com
http://pydish.holdenweb.com
Holden Web LLC +1 800 494 3119
Jul 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.