Re: [Pythonmac-SIG] PIL binaries -- please test
Christopher Barker <[email protected]>
| Newsgroups | gmane.comp.python.image,gmane.comp.python.apple |
|---|---|
| Message-ID | <[email protected]> |
Matthias Baas wrote: > Christopher Barker wrote: > Ha! I haven't had a look at selftest.py before. That script requires an > inplace build which I didn't do. Instead, I was pointing PYTHONPATH > inside the build directory yup -- that will confuse things. > But when I link > against the static lib, the test script only runs fine because it > imports the tk module before the freetype one. Whereas when I just > import _imagingft, I get this: > >>>> import PIL._imagingft > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > ImportError: dlopen(PIL/_imagingft.so, 2): Symbol not found: _FSOpenResFile > Referenced from: PIL/_imagingft.so > Expected in: dynamic lookup > > This error does not occur if _imagingtk is imported first. So it looks > like we would have to link against some system library when building > _imagingft. could be -- I'm clueless on that one, but if I try in it: >>> import PIL._imagingft Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PIL/_imagingft.so, 2): Symbol not found: _inflateEnd Referenced from: /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PIL/_imagingft.so Expected in: dynamic lookup What I don't know is if we should expect -imagingft to b importable all by itself, first. Though I wouldn't think it should depend on TK. If I do: >>> import PIL._imaging >>> import PIL._imagingft it works fine -- which makes sense --you'd never need to import _imagingft without importing _imaging first. > By the way, _imaging.so still depends on /usr/lib/libz.1.dylib, but I > suppose as this is a library that ships with OSX, this should be > available on all systems and so it should be fine. Is this correct? yes -- that's correct. I'd say if all the self-tests run, you're in pretty good shape. Try the enclosed test, too -- it uses freetype, without TK (at least not explicitly) -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [email protected] _______________________________________________ Image-SIG maillist - [email protected] http://mail.python.org/mailman/listinfo/image-sig
SimplePILTest.py
(application/x-python, 614 B)
#!/usr/bin/env python
"""
ultra simple PIL test
"""
import sys
from PIL import Image, ImageFont, ImageDraw
if len(sys.argv) > 1:
files = sys.argv[1:]
else:
files = ['lena.jpg']
for filename in files:
print "Processing:", filename
im = Image.open(filename)
print "It is a %s, %s, %s image"%(im.format, im.size, im.mode)
print "writing out a version with some text on it:"
draw = ImageDraw.Draw(im)
font = ImageFont.truetype("veraBd.ttf", 15)
draw.text((10, 20), "WaterMark", font=font)
outfilename = filename[:-3] + "watermarked.jpg"
im.save(outfilename)