I know this is mostly a python/PIL question, but I figured someone here may have experienced this. I am using FreeBSD4.0, Python1.5.2 I am trying to use PIL to manipulate Zope images. I already have the IJG jpeg-6b library installed. I then successfully (at least it looked successful) built and installed PIL. PIL works fine for all image formats except JPEG. For JPEG it gives me the following error:
image.save("newimage","JPEG") Traceback (innermost last): File "<stdin>", line 1, in ? File "PIL/Image.py", line 720, in save SAVE[string.upper(format)](self, fp, filename) File "PIL/JpegImagePlugin.py", line 306, in _save ImageFile._save(im, fp, [("jpeg", (0,0)+im.size, 0, rawmode)]) File "PIL/ImageFile.py", line 369, in _save e = Image._getencoder(im.mode, e, a, im.encoderconfig) File "PIL/Image.py", line 259, in _getencoder raise IOError, "encoder %s not available" % encoder_name IOError: encoder jpeg not available
It looks to me like the jpeg library has not been bound? with PIL?. I am very new as this sort of thing and I know almost nothing about building from source and shared libraries, so I most probably did something stupid. I checked the Setup file in the PIL build and it seems to point to the correct directories for the jpeg library. Any hints would be appreciated. Thanks Tom
Tom Cameron writes:
File "PIL/Image.py", line 259, in _getencoder raise IOError, "encoder %s not available" % encoder_name IOError: encoder jpeg not available
Look in "PIL/Image.py" near line 259 what it tries to get the encoder.
Do it yourself in an interactive interpreter. The exception will probably give you a hint towards the actual problem. Dieter
Dieter, Thanks for the help, It turns out that when you compile the PIL library you need to edit the file ImConfig.h to enable the handling of jpeg files. As far as I can see this is mentioned nowhere in any of the documentation for PIL and I only found it by many hours of searching and some chance. Hopefully this message will help someone in the future. Tom => -----Original Message----- => From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of => Dieter Maurer => Sent: Tuesday, 24 July 2001 7:15 AM => To: tom@mooball.com => Cc: zope@zope.org => Subject: Re: [Zope] PIL and JPG encoder. => => => Tom Cameron writes: => > File "PIL/Image.py", line 259, in _getencoder => > raise IOError, "encoder %s not available" % encoder_name => > IOError: encoder jpeg not available => > >>> => Look in "PIL/Image.py" near line 259 what it tries to get => the encoder. => => Do it yourself in an interactive interpreter. => The exception will probably give you a hint towards the => actual problem. => => => Dieter => => _______________________________________________ => Zope maillist - Zope@zope.org => http://lists.zope.org/mailman/listinfo/zope => ** No cross posts or HTML encoding! ** => (Related lists - => http://lists.zope.org/mailman/listinfo/zope-announce => http://lists.zope.org/mailman/listinfo/zope-dev ) =>
participants (3)
-
Dieter Maurer -
Tom Cameron -
Tom Cameron