[Image-SIG] PIL/JPEG trouble
Dinu Gherman
gherman@darwin.in-berlin.de
Mon, 5 Aug 2002 15:38:44 +0200
--Apple-Mail-1-855400444
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
format=flowed
Hi, I've just joined this mailing list after running into a problem
that seems to be a reoccurring one, at least if I look into the list
archives. I thought it should not occur anymore after PIL moved to
using distutils, but maybe it's me doing something wrong? Has any-
body else succeeded in compiling PIL with JPEG support on Mac OS X?
Thanks,
Dinu
Forwarded from Pythonmac-SIG:
> Von: Dinu Gherman <gherman@darwin.in-berlin.de>
> Datum: Mo, 05. Aug. 2002 12:05:56 Europe/Berlin
> An: pythonmac-sig@python.org
> Betreff: [Pythonmac-SIG] PIL/JPEG trouble
>
> Hi, I've got some trouble on OS X telling PIL where to find the JPEG
> library. This results in "IOError: decoder jpeg not available" errors.
>
> I've installed JIG's library libjpeg.a into /usr/local/lib and its
> tools into /usr/local/bin (wrjpgcom, rdjpgcom, jpegtran, djpeg, cjpeg).
> I've also tried a configure pass with --with-jpeg=/usr/local/lib but
> all in vain.
>
> I've attached a sample installation script which should automatically
> fetch zlib, jpeg and pil from the net and install them the "canonical"
> way... Below I've also pasted the results of running PIL's
> MiniTest/test.py.
>
> Does anybody have an idea?
>
> Thanks,
>
> Dinu
>
>
> [localhost:Imaging-1.1.3] dinu% python MiniTest/test.py
> *****************************************************************
> Failure in example: _info(Image.open("Images/lena.jpg"))
> from line #24 of test.testimage
> Exception raised:
> Traceback (most recent call last):
> File "MiniTest/doctest.py", line 499, in _run_examples_inner
> exec compile(source, "<string>", "single") in globs
> File "<string>", line 1, in ?
> File "MiniTest/test.py", line 12, in _info
> im.load()
> File "PIL/ImageFile.py", line 140, in load
> d = Image._getdecoder(self.mode, d, a, self.decoderconfig)
> File "PIL/Image.py", line 255, in _getdecoder
> raise IOError("decoder %s not available" % decoder_name)
> IOError: decoder jpeg not available
> *****************************************************************
> Failure in example: type(im.im) # internal image attribute
> from line #31 of test.testimage
> Expected: <type 'None'>
> Got: <type 'NoneType'>
> 1 items had failures:
> 2 of 40 in test.testimage
> ***Test Failed*** 2 failures.
> *** 2 tests of 40 failed.
>
>
--Apple-Mail-1-855400444
Content-Disposition: attachment;
filename=install.py
Content-Transfer-Encoding: 7bit
Content-Type: application/text;
x-mac-creator=522A6368;
x-unix-mode=0644;
x-mac-type=54455854;
name="install.py"
#! /usr/bin/env python
"""install.py - a funky install script.
Sample usage:
python install.py zlib jpeg pil
python install.py pil
"""
import os, string, sys
from os.path import basename, join
from urllib import urlopen
###############################################################################
# Package descriptions
###############################################################################
jpeg = {
"name": "JPEG Support for PIL",
"homepage": "http://www.ijg.org",
"download": "http://www.ijg.org/files/jpegsrc.v6b.tar.gz",
"install": """\
tar xfz jpegsrc.v6b.tar.gz
cd jpeg-6b
./configure
make
make test
sudo make install
sudo make install-lib
"""}
zlib = {
"name": "Zlib",
"homepage": "http://www.gzip.org/zlib/",
"download": "http://www.gzip.org/zlib/zlib-1.1.4.tar.gz",
"install": """\
tar xfz zlib-1.1.4.tar.gz
cd zlib-1.1.4
./configure
make
sudo make install
"""}
pil = {
"name": "PythonWare's PIL 1.1.3",
"homepage": "http://www.pythonware.com/products/python/index.htm",
"download": "http://www.pythonware.com/downloads/Imaging-1.1.3.tar.gz",
"install": """\
tar xfz Imaging-1.1.3.tar.gz
cd Imaging-1.1.3
cd libImaging
./configure
make
cd ..
python setup.py build
sudo python setup.py install
"""}
###############################################################################
# Installation
###############################################################################
def install(packages):
dir = os.getcwd()
for p in packages:
try:
p = globals()[p]
except:
print "Skipping", p
continue
# get package details
name = p['name']
url = p['download']
instructions = p['install']
# download, if needed
path = join(dir, basename(url))
if not os.path.exists(path):
print "Downloading", name
data = urlopen(url).read()
open(path, "wb").write(data)
# install
print "Installing", name
open('install.sh', 'w').write(instructions)
os.system('tcsh -f install.sh')
if __name__ == '__main__':
packages = sys.argv[1:]
install(packages)
--Apple-Mail-1-855400444--