From tschulze at nuthole.de Mon Apr 5 14:14:28 2004 From: tschulze at nuthole.de (Theo. Sean Schulze) Date: Mon Apr 5 14:14:50 2004 Subject: [Image-SIG] Compile problem with 1.1.4 and freetype2 Message-ID: <4071A204.2060006@nuthole.de> Hello, I am trying to build PIL 1.1.4 on a Slackware-current system running kernel 2.6.4. gcc is 3.3.3. I have freetype2 2.1.7 installed from source with --prefix=/usr set during configuration. libImaging seems to build ok, at least it does not produce any errors when it compiles after the make command. I then change to the base directory Imaging-1.1.4 and issue the command `python setup.py build`. Whether I issue the command as a user or as root, I get the following output: building '_imagingft' extension gcc -pthread -fno-strict-aliasing -DNDEBUG -O3 -march=i486 -mcpu=i686 -fPIC -IlibImaging -I/usr/include/freetype2 -I/usr/include/python2.3 -c _imagingft.c -o build/temp.linux-i686-2.3/_imagingft.o In file included from _imagingft.c:18: /usr/include/freetype2/freetype/freetype.h:20:2: #error "`ft2build.h' hasn't been included yet!" /usr/include/freetype2/freetype/freetype.h:21:2: #error "Please always use macros to include FreeType header files." /usr/include/freetype2/freetype/freetype.h:22:2: #error "Example:" /usr/include/freetype2/freetype/freetype.h:23:2: #error " #include " /usr/include/freetype2/freetype/freetype.h:24:2: #error " #include FT_FREETYPE_H" error: command 'gcc' failed with exit status 1 Can someone offer me some advice as to how to fix this? TIA, Sean From tschulze at nuthole.de Mon Apr 5 16:28:32 2004 From: tschulze at nuthole.de (Theo. Sean Schulze) Date: Mon Apr 5 16:28:42 2004 Subject: [Image-SIG] Compile problem with 1.1.4 and freetype2 In-Reply-To: <4071A204.2060006@nuthole.de> References: <4071A204.2060006@nuthole.de> Message-ID: <4071C170.40408@nuthole.de> OK, I think I have been able to fix this. Looking at the error message again, it seemed that I needed to add an #include statement in _imagingtf.c. So, I added "#include " just before line 18 in _imagingtf.c, and it seems to have compiled. Theo. Sean Schulze wrote: > Hello, > > I am trying to build PIL 1.1.4 on a Slackware-current system running > kernel 2.6.4. gcc is 3.3.3. I have freetype2 2.1.7 installed from > source with --prefix=/usr set during configuration. libImaging seems > to build ok, at least it does not produce any errors when it compiles > after the make command. I then change to the base directory > Imaging-1.1.4 and issue the command `python setup.py build`. Whether > I issue the command as a user or as root, I get the following output: > > building '_imagingft' extension > gcc -pthread -fno-strict-aliasing -DNDEBUG -O3 -march=i486 -mcpu=i686 > -fPIC -IlibImaging -I/usr/include/freetype2 -I/usr/include/python2.3 > -c _imagingft.c -o build/temp.linux-i686-2.3/_imagingft.o > In file included from _imagingft.c:18: > /usr/include/freetype2/freetype/freetype.h:20:2: #error "`ft2build.h' > hasn't been included yet!" > /usr/include/freetype2/freetype/freetype.h:21:2: #error "Please always > use macros to include FreeType header files." > /usr/include/freetype2/freetype/freetype.h:22:2: #error "Example:" > /usr/include/freetype2/freetype/freetype.h:23:2: #error " #include > " > /usr/include/freetype2/freetype/freetype.h:24:2: #error " #include > FT_FREETYPE_H" > error: command 'gcc' failed with exit status 1 > > Can someone offer me some advice as to how to fix this? > > TIA, > Sean > > > _______________________________________________ > Image-SIG maillist - Image-SIG@python.org > http://mail.python.org/mailman/listinfo/image-sig > From fredrik at pythonware.com Mon Apr 5 17:09:24 2004 From: fredrik at pythonware.com (Fredrik Lundh) Date: Mon Apr 5 17:09:34 2004 Subject: [Image-SIG] Re: Compile problem with 1.1.4 and freetype2 References: <4071A204.2060006@nuthole.de> <4071C170.40408@nuthole.de> Message-ID: Theo. Sean Schulze wrote: > OK, I think I have been able to fix this. Looking at the error message > again, it seemed that I needed to add an #include statement in > _imagingtf.c. So, I added "#include " just before line 18 > in _imagingtf.c, and it seems to have compiled. the freetype2 authors tend to change things around between releases; a quick googling indicates that PIL approach (which was correct according to the freetype docs when I wrote that code) works in 2.1.5, but not in 2.1.7. sigh. From virusguard at fi.fujitsu.com Fri Apr 9 12:28:25 2004 From: virusguard at fi.fujitsu.com (virusguard@fi.fujitsu.com) Date: Fri Apr 9 05:28:07 2004 Subject: [Image-SIG] Network Associates Webshield - e-mail Content Alert Message-ID: <200404090927.i399RuMl001318@harmaja.edelkey.net> Your mail to was blocked and NOT delivered because attachment was not allowed. From tthaxton at compuserve.com Mon Apr 12 06:55:55 2004 From: tthaxton at compuserve.com (Tthaxton) Date: Mon Apr 12 12:55:53 2004 Subject: [Image-SIG] have any trouble with health ? we may help you... more In-Reply-To: References: Message-ID: http://fulmun.biz/PH009/?affiliate_id=233642&campaign_id=407 From marilyn at deliberate.com Wed Apr 14 01:35:48 2004 From: marilyn at deliberate.com (Marilyn Davis) Date: Wed Apr 14 01:36:00 2004 Subject: [Image-SIG] mod_python and PIL? Message-ID: Hi, I'm trying to put together python2.3 with Imaging-1.1.4 and mod_python-2.7.8 and am having trouble. Can anyone here help me? The final result is: Cannot load /www/libexec/mod_python.so into server: /www/libexec/mod_python.so: undefined symbol: pthread_sigmask I build python-2.3.3 without threads: [root@maildance Python-2.3.3]# ./configure --with-threads=no and in the end I see things like: *** WARNING: renaming "_testcapi" since importing it failed: build/lib.linux-i686-2.3/_testcapi.so: undefined symbol: PyGILState_Ensure *** WARNING: renaming "_bsddb" since importing it failed: build/lib.linux-i686-2.3/_bsddb.so: undefined symbol: PyGILState_Ensure *** WARNING: renaming "zlib" since importing it failed: build/lib.linux-i686-2.3/zlib.so: undefined symbol: PyThread_acquire_lock *** WARNING: renaming "bz2" since importing it failed: build/lib.linux-i686-2.3/bz2.so: undefined symbol: PyThread_acquire_lock *** WARNING: renaming "_tkinter" since importing it failed: build/lib.linux-i686-2.3/_tkinter.so: undefined symbol: PyThread_acquire_lock running build_scripts [root@maildance Python-2.3.3]# So I guess that means that threads aren't happening? I notice, though, that when I "python2.3 setup.py build" to make PIL, I get lots like this: [root@maildance Imaging-1.1.4]# python2.3 setup.py build gcc -pthread -shared build/temp.linux-i686-2.3/_imaging.o build/temp.linux-i686-2.3/decode.o build/temp.linux-i686-2.3/encode.o build/temp.linux-i686-2.3/map.o build/temp.linux-i686-2.3/display.o build/temp.linux-i686-2.3/outline.o build/temp.linux-i686-2.3/path.o -LlibImaging -lImaging -ljpeg -lz -o build/lib.linux-i686-2.3/_imaging.so building '_imagingtk' extension creating build/temp.linux-i686-2.3/Tk gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -IlibImaging -I/usr/local/include/python2.3 -c Tk/tkImaging.c -o build/temp.linux-i686-2.3/Tk/tkImaging.o So I see that -pthread and wonder if that's what's causing it and what can I do about it? Thank you for any help anyone can give. Marilyn Davis, Ph.D marilyn@deliberate.com -1 650 965-7121 Author of eVote(R)/Clerk http://www.deliberate.com From marilyn at deliberate.com Wed Apr 14 21:12:52 2004 From: marilyn at deliberate.com (Marilyn Davis) Date: Wed Apr 14 21:12:57 2004 Subject: [Image-SIG] mod_python and PIL? In-Reply-To: Message-ID: We fixed this by moving to Apache 2. All is well now. Thank you. Marilyn On Tue, 13 Apr 2004, Marilyn Davis wrote: > Hi, > > I'm trying to put together python2.3 with Imaging-1.1.4 and > mod_python-2.7.8 and am having trouble. Can anyone here help me? > > The final result is: > > Cannot load /www/libexec/mod_python.so into server: /www/libexec/mod_python.so: undefined symbol: pthread_sigmask > > I build python-2.3.3 without threads: > > [root@maildance Python-2.3.3]# ./configure --with-threads=no > > and in the end I see things like: > > *** WARNING: renaming "_testcapi" since importing it failed: build/lib.linux-i686-2.3/_testcapi.so: undefined symbol: PyGILState_Ensure > *** WARNING: renaming "_bsddb" since importing it failed: build/lib.linux-i686-2.3/_bsddb.so: undefined symbol: PyGILState_Ensure > *** WARNING: renaming "zlib" since importing it failed: build/lib.linux-i686-2.3/zlib.so: undefined symbol: PyThread_acquire_lock > *** WARNING: renaming "bz2" since importing it failed: build/lib.linux-i686-2.3/bz2.so: undefined symbol: PyThread_acquire_lock > *** WARNING: renaming "_tkinter" since importing it failed: build/lib.linux-i686-2.3/_tkinter.so: undefined symbol: PyThread_acquire_lock > running build_scripts > [root@maildance Python-2.3.3]# > > So I guess that means that threads aren't happening? > > I notice, though, that when I "python2.3 setup.py build" to make PIL, > I get lots like this: > > [root@maildance Imaging-1.1.4]# python2.3 setup.py build > gcc -pthread -shared build/temp.linux-i686-2.3/_imaging.o build/temp.linux-i686-2.3/decode.o build/temp.linux-i686-2.3/encode.o build/temp.linux-i686-2.3/map.o build/temp.linux-i686-2.3/display.o build/temp.linux-i686-2.3/outline.o build/temp.linux-i686-2.3/path.o -LlibImaging -lImaging -ljpeg -lz -o build/lib.linux-i686-2.3/_imaging.so > building '_imagingtk' extension > creating build/temp.linux-i686-2.3/Tk > gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -IlibImaging -I/usr/local/include/python2.3 -c Tk/tkImaging.c -o build/temp.linux-i686-2.3/Tk/tkImaging.o > > So I see that -pthread and wonder if that's what's causing it and what > can I do about it? > > Thank you for any help anyone can give. > > Marilyn Davis, Ph.D marilyn@deliberate.com -1 650 965-7121 > Author of eVote(R)/Clerk http://www.deliberate.com > > > > _______________________________________________ > Image-SIG maillist - Image-SIG@python.org > http://mail.python.org/mailman/listinfo/image-sig > -- From bali at dkrz.de Thu Apr 15 11:01:49 2004 From: bali at dkrz.de (Manik Bali) Date: Thu Apr 15 11:01:57 2004 Subject: [Image-SIG] buffer is not large enough In-Reply-To: Message-ID: Hi I am trying to make a histogram() for my pgm image( which is basically a four line header information followed by binary data ) And it gives the following error. >>> import Image >>> im=Image.open("glc2000_beta3.pgm") >>> im.histogram() Traceback (most recent call last): File "", line 1, in ? File "/scratch/local2/m212005/opt/cdat/lib/python2.2/site-packages/PIL/Image.py", line 807, in histogram self.load() File "/scratch/local2/m212005/opt/cdat/lib/python2.2/site-packages/PIL/ImageFile.py", line 144, in load self.im = Image.core.map_buffer( ValueError: buffer is not large enough The size of pgm file is 591614803. Is there a way out.. Rgds Manik Bali Max Planck Institute. Germany From fredrik at pythonware.com Thu Apr 15 12:10:52 2004 From: fredrik at pythonware.com (Fredrik Lundh) Date: Thu Apr 15 12:11:45 2004 Subject: [Image-SIG] Re: buffer is not large enough References: Message-ID: Manik Bali wrote: > I am trying to make a histogram() for my pgm image( which is basically a > four line header information followed by binary data ) > And it gives the following error. > >>> import Image > >>> im=Image.open("glc2000_beta3.pgm") > >>> im.histogram() > Traceback (most recent call last): ... > ValueError: buffer is not large enough > > The size of pgm file is 591614803. > Is there a way out.. what does this print: >>> im = Image.open(filename) >>> im.size >>> im.mode >>> im.tile does this work? >>> im = Image.open(filename) >>> im.filename = None # disable mapping >>> im.load() >>> im.histogram() From bali at dkrz.de Thu Apr 15 12:30:59 2004 From: bali at dkrz.de (Manik Bali) Date: Thu Apr 15 12:31:04 2004 Subject: [Image-SIG] Re: buffer is not large enough In-Reply-To: Message-ID: Hi Fredrik They work like... >>> import Image >>> im = Image.open("glc2000_beta3.pgm") >>> im.size (40320, 14673) >>> im.mode 'L' >>> im.tile [('raw', (0, 0, 40320, 14673), 18L, ('L', 0, 1))] >>> and then when i give anyother command like histogram() etc it gives buffer not large enough Rgds Manik On Thu, 15 Apr 2004, Fredrik Lundh wrote: > Manik Bali wrote: > > > I am trying to make a histogram() for my pgm image( which is basically a > > four line header information followed by binary data ) > > And it gives the following error. > > >>> import Image > > >>> im=Image.open("glc2000_beta3.pgm") > > >>> im.histogram() > > Traceback (most recent call last): > ... > > ValueError: buffer is not large enough > > > > The size of pgm file is 591614803. > > Is there a way out.. > > what does this print: > > >>> im = Image.open(filename) > >>> im.size > >>> im.mode > >>> im.tile > > does this work? > > >>> im = Image.open(filename) > >>> im.filename = None # disable mapping > >>> im.load() > >>> im.histogram() > > > > > > > _______________________________________________ > Image-SIG maillist - Image-SIG@python.org > http://mail.python.org/mailman/listinfo/image-sig > From fredrik at pythonware.com Thu Apr 15 12:39:38 2004 From: fredrik at pythonware.com (Fredrik Lundh) Date: Thu Apr 15 12:39:43 2004 Subject: [Image-SIG] Re: Re: buffer is not large enough References: Message-ID: Manik Bali wrote: > >>> import Image > >>> im = Image.open("glc2000_beta3.pgm") > >>> im.size > (40320, 14673) note that 40320*14673 is 591615360, which indicates that the file you're trying to read is truncated. did you try the workaround I suggested: > > >>> im = Image.open(filename) > > >>> im.filename = None # disable mapping > > >>> im.load() > > >>> im.histogram() (this is likely to give you another error message, though) you can ask PIL to read everything except the last line from the file, by modifying the size and tile attributes before you call any other method: >>> im = Image.open(...) >>> im.size = (40320, 14673-1) >>> im.tile = [('raw', (0, 0, 40320, 14673-1), 18L, ('L', 0, 1))] From marilyn at deliberate.com Fri Apr 16 03:55:28 2004 From: marilyn at deliberate.com (Marilyn Davis) Date: Fri Apr 16 03:55:31 2004 Subject: [Image-SIG] Hard to OCR Font In-Reply-To: Message-ID: Hi, Now that I have PIL going, I need to find a "hard to OCR" font. Can anyone provide suggestions or clues? What makes a font hard to OCR? Thank you for your thoughts. Marilyn Davis From smurf at smurf.noris.de Fri Apr 16 04:15:42 2004 From: smurf at smurf.noris.de (Matthias Urlichs) Date: Fri Apr 16 04:17:01 2004 Subject: [Image-SIG] Hard to OCR Font In-Reply-To: References: Message-ID: <20040416081541.GA22193@kiste> Hi, Marilyn Davis: > Now that I have PIL going, I need to find a "hard to OCR" font. > > Can anyone provide suggestions or clues? What makes a font hard to > OCR? fractured or stencilled letters, being slanted, wavy, on a curved baseline, or otherwise distorted; run a few lines through the text, print two words "almost" on top of each other so that the letters touch, ... you get the idea. -- Matthias Urlichs -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://mail.python.org/pipermail/image-sig/attachments/20040416/6f6b1081/attachment.bin From gik at freehand.ru Fri Apr 16 04:33:47 2004 From: gik at freehand.ru (Gennady Kovalev) Date: Fri Apr 16 04:33:37 2004 Subject: [Image-SIG] store ttf outside filesystem Message-ID: <200404161233.47392.gik@freehand.ru> Hi! I'm try to generate images with text in Zope+CMF, so we write graphic tool for CMF. I want to store fonts in ZODB. So PIL font worked propertly, but TTF not. How i can tell FreeTypeFont to use not file name, but file handler, or StringIO? Thanks, Gennady Kovalev. From fredrik at pythonware.com Fri Apr 16 07:16:51 2004 From: fredrik at pythonware.com (Fredrik Lundh) Date: Fri Apr 16 07:16:38 2004 Subject: [Image-SIG] Re: Hard to OCR Font References: <20040416081541.GA22193@kiste> Message-ID: Matthias Urlichs wrote: > fractured or stencilled letters, being slanted, wavy, on a curved > baseline, or otherwise distorted; run a few lines through the text, > print two words "almost" on top of each other so that the letters touch, footnote: you can use im.transform(size, MESH, data) to warp and distort text rendered by ImageDraw/ImageFont. From fredrik at pythonware.com Fri Apr 16 08:06:42 2004 From: fredrik at pythonware.com (Fredrik Lundh) Date: Fri Apr 16 08:06:29 2004 Subject: [Image-SIG] Re: store ttf outside filesystem References: <200404161233.47392.gik@freehand.ru> Message-ID: Gennady Kovalev wrote: > I'm try to generate images with text in Zope+CMF, so we write graphic tool for > CMF. I want to store fonts in ZODB. So PIL font worked propertly, but TTF > not. > > How i can tell FreeTypeFont to use not file name, but file handler, or > StringIO? you cannot, unless you add that functionality to the PIL FreeType bindings (assuming freetype supports memory buffers, that is). to use existing code, you'll have to copy each font to a temporary file during drawing. From marilyn at deliberate.com Fri Apr 16 20:06:41 2004 From: marilyn at deliberate.com (Marilyn Davis) Date: Fri Apr 16 20:06:46 2004 Subject: [Image-SIG] Re: Hard to OCR Font In-Reply-To: Message-ID: On Fri, 16 Apr 2004, Fredrik Lundh wrote: > Matthias Urlichs wrote: > > > fractured or stencilled letters, being slanted, wavy, on a curved > > baseline, or otherwise distorted; run a few lines through the text, > > print two words "almost" on top of each other so that the letters touch, > > footnote: you can use im.transform(size, MESH, data) to warp and > distort text rendered by ImageDraw/ImageFont. Thank you. And I'm sorry to be so dense. As far as I can tell, the only font that I have is a small courier font. So, to start, I should install a larger font because I do want humans to read the font? Is there a suggestion for finding/generating fonts? I don't see any .pcf files in my system and only one .bdf: vfontcap.bdf. But when I "pilfont.py vfontcap.bdf", I get a "... failed" Am I making this too hard? Should I, instead, enlarge the small courier font that I get for free? Thank you for any help. Marilyn Davis > > > > > > > _______________________________________________ > Image-SIG maillist - Image-SIG@python.org > http://mail.python.org/mailman/listinfo/image-sig > -- From hendry at cs.helsinki.fi Sat Apr 17 10:35:05 2004 From: hendry at cs.helsinki.fi (Kai Hendry) Date: Sat Apr 17 10:34:51 2004 Subject: [Image-SIG] tostring Message-ID: <20040417143459.GA26288@cs.helsinki.fi> I can't work out tostring. Could someone fix this or provide me an example? #!/usr/bin/python2.3 import Image jpgimage = '/home/hendry/kodak/DCP_6655.JPG' print "Content-Type: image/jpeg" print #this works of course #print open(jpgimage).read() i = Image.open(jpgimage) #print i.tostring() #this isn't ... print i.tostring("jpeg", '') From fredrik at pythonware.com Sat Apr 17 10:52:04 2004 From: fredrik at pythonware.com (Fredrik Lundh) Date: Sat Apr 17 10:51:50 2004 Subject: [Image-SIG] Re: tostring References: <20040417143459.GA26288@cs.helsinki.fi> Message-ID: Kai Hendry wrote: > I can't work out tostring. Could someone fix this or provide me an > example? tostring copies the pixels in the image to a Python string buffer (the opposite of fromstring). if you want to save an image to stdout, just save it to stdout: im.save(sys.stdout) if you want to save an image to a string, use the StringIO module: import StringIO ... out = StringIO.StringIO() im.save(out) data = out.getvalue() From marilyn at deliberate.com Sat Apr 17 17:34:55 2004 From: marilyn at deliberate.com (Marilyn Davis) Date: Sat Apr 17 17:34:59 2004 Subject: [Image-SIG] Re: Hard to OCR Font In-Reply-To: Message-ID: Hello again, I'm once again begging for hints about this. I've googled and googled. It's been discussed on this list and someone provided a link to some fonts in .pil, but the link is gone now. So here I tried cursive.bdf from Tom's X11 fonts: [root@maildance Images]# ../Scripts/bdf2pil.py cursive.bdf BDF2PIL 1.0 -- Font compiler for X BDF fonts. Copyright (c) Fredrik Lundh 1996. All rights reserved. cursive.bdf # Fine;Cursive;Medium;Italic;Normal;;13;130;72;72;Cell;120;ISO8859;1 Traceback (most recent call last): File "../Scripts/bdf2pil.py", line 205, in ? image, srcbbox = font2image(font, ascent, descent) File "../Scripts/bdf2pil.py", line 155, in font2image d = Image.core.hex_decoder("1") TypeError: function takes exactly 2 arguments (1 given) [root@maildance Images]# Here I tried loading a truetype font: [webedit@maildance cgi]$ !! ./stealth_image.py Traceback (most recent call last): File "./stealth_image.py", line 112, in ? f,a = image_file() File "./stealth_image.py", line 83, in image_file im, pattern = gen_image() File "./stealth_image.py", line 61, in gen_image font = ImageFont.truetype('../images/toast.ttf',20) File "/usr/local/lib/python2.3/site-packages/PIL/ImageFont.py", line 189, in truetype return FreeTypeFont(filename, size, index) File "/usr/local/lib/python2.3/site-packages/PIL/ImageFont.py", line 117, in __init__ self.font = _imagingft.getfont(file, size, index) IOError: cannot load font In this line: font = ImageFont.truetype('../images/toast.ttf',20) I just invented the 20, hoping it would result in a big font. Just hoping for a little help, Marilyn Davis From chris at cogdon.org Sat Apr 17 17:56:32 2004 From: chris at cogdon.org (Chris Cogdon) Date: Sat Apr 17 17:56:47 2004 Subject: [Image-SIG] Re: Hard to OCR Font In-Reply-To: References: Message-ID: <16648530-90BA-11D8-A537-000A95E3823E@cogdon.org> On Apr 17, 2004, at 14:34, Marilyn Davis wrote: > Just hoping for a little help, YOu might also want to do a google search for 'Captcha', which is a open project to generate text that is hard or impossible for computers to OCR. -- ("`-/")_.-'"``-._ Chris Cogdon . . `; -._ )-;-,_`) (v_,)' _ )`-.\ ``-' _.- _..-_/ / ((.' ((,.-' ((,/ fL From marilyn at deliberate.com Sat Apr 17 21:02:04 2004 From: marilyn at deliberate.com (Marilyn Davis) Date: Sat Apr 17 21:02:08 2004 Subject: [Image-SIG] Re: Hard to OCR Font Message-ID: Thank you Chris. That's interesting. I'm sure I could fix up something if I could load a font. I'll try some more Monday. Thank you again. Marilyn On Sat, 17 Apr 2004, Chris Cogdon wrote: > > On Apr 17, 2004, at 14:34, Marilyn Davis wrote: > > > Just hoping for a little help, > > YOu might also want to do a google search for 'Captcha', which is a > open project to generate text that is hard or impossible for computers > to OCR. > > > -- From hendry at cs.helsinki.fi Sun Apr 18 05:56:27 2004 From: hendry at cs.helsinki.fi (Kai Hendry) Date: Sun Apr 18 05:57:11 2004 Subject: [Image-SIG] comment Message-ID: <20040418095627.GB1078@cs.helsinki.fi> Thanks Fredrik for previous reply. I want to read (and insert) comments into my jpeg files. I like to do this the way jhead does it: jhead -cl "A longer comment" pict0725.jpg But it's difficult to just read out the comment field in jhead (at least I have not discovered to do it). Anyway, preferably I would do this in python. Is there some way of reading the comment field? From fredrik at pythonware.com Sun Apr 18 08:13:11 2004 From: fredrik at pythonware.com (Fredrik Lundh) Date: Sun Apr 18 08:12:55 2004 Subject: [Image-SIG] Re: comment References: <20040418095627.GB1078@cs.helsinki.fi> Message-ID: Kai Hendry wrote: > Thanks Fredrik for previous reply. > > I want to read (and insert) comments into my jpeg files. > > I like to do this the way jhead does it: > jhead -cl "A longer comment" pict0725.jpg > > But it's difficult to just read out the comment field in jhead (at least > I have not discovered to do it). > > Anyway, preferably I would do this in python. Is there some way of > reading the comment field? yes, but you need to patch your PIL installation: http://mail.python.org/pipermail/image-sig/2004-January/002534.html From cbass233 at yahoo.com Sun Apr 18 13:45:49 2004 From: cbass233 at yahoo.com (Chuck Bass) Date: Sun Apr 18 13:45:55 2004 Subject: [Image-SIG] Hard to OCR font In-Reply-To: Message-ID: <20040418174549.76100.qmail@web13907.mail.yahoo.com> It depends what you are trying to do. I've looked at what various sites do to prevent autoregistration and they use a 'normal' font with a complex background and lines (and other geometries) going through the data. Typically the background is much bigger than the text. The 'complex' background is quite random ususally, in some ways like b/w camoflauge. Try to register for a yahoo group to see thier method. It seems to me if you use a 'standard font' on white background you will be suseptable to various correlation methods of deducing the text. Chuck __________________________________ Do you Yahoo!? Yahoo! Photos: High-quality 4x6 digital prints for 25¢ http://photos.yahoo.com/ph/print_splash From douglas at paradise.net.nz Sun Apr 18 17:48:49 2004 From: douglas at paradise.net.nz (Douglas Bagnall) Date: Sun Apr 18 17:48:42 2004 Subject: [Image-SIG] Re: tostring In-Reply-To: References: <20040417143459.GA26288@cs.helsinki.fi> Message-ID: <4082F7C1.9050701@paradise.net.nz> hi, Fredrik Lundh wrote: > > if you want to save an image to a string, use the StringIO module: > > import StringIO > ... > out = StringIO.StringIO() > im.save(out) > data = out.getvalue() I've found that this works data = im.tostring("jpeg", ('RGB',)) and is a bit quicker than the stringIO method. Writing directly to sys.stdout is simpler, but beware in a web context - some browsers like the content-length header to be set (ie, print "Content-length: %s" % len(data)). douglas From marilyn at deliberate.com Sun Apr 18 22:52:49 2004 From: marilyn at deliberate.com (Marilyn Davis) Date: Sun Apr 18 22:52:53 2004 Subject: [Image-SIG] ImageFont on Linux? Was: Hard to OCR font In-Reply-To: <20040418174549.76100.qmail@web13907.mail.yahoo.com> Message-ID: On Sun, 18 Apr 2004, Chuck Bass wrote: > It depends what you are trying to do. > > I've looked at what various sites do to prevent autoregistration and > they use a 'normal' font with a complex background and lines (and > other geometries) going through the data. Typically the background > is much bigger than the text. The 'complex' background is quite > random ususally, in some ways like b/w camoflauge. > > Try to register for a yahoo group to see thier method. Yes, Chuck, it's cool stuff. I'm dying to try to do something. I'm going to use it to block mail, except from humans. I'm tired of struggling with spam-filter schemes. > It seems to me if you use a 'standard font' on white background you > will be suseptable to various correlation methods of deducing the > text. Yes, I don't want to use 'standard font'. I found lots of cool fonts but I can't get them to load. I'm wondering, are there issues with using ImageFont with Linux? Has it been tested? I keep thinking I'm doing something wrong. Has anyone made .pil's on Linux? If I make .pil's on Windows, are they good on Linux too? I guess I'll try that next. Thank you for your thoughts. Marilyn > > Chuck > > > > > __________________________________ > Do you Yahoo!? > Yahoo! Photos: High-quality 4x6 digital prints for 25? > http://photos.yahoo.com/ph/print_splash > > _______________________________________________ > Image-SIG maillist - Image-SIG@python.org > http://mail.python.org/mailman/listinfo/image-sig > -- From chris at cogdon.org Sun Apr 18 23:11:38 2004 From: chris at cogdon.org (Chris Cogdon) Date: Sun Apr 18 23:12:01 2004 Subject: [Image-SIG] ImageFont on Linux? Was: Hard to OCR font In-Reply-To: References: Message-ID: <46029F84-91AF-11D8-A537-000A95E3823E@cogdon.org> On Apr 18, 2004, at 19:52, Marilyn Davis wrote: > > On Sun, 18 Apr 2004, Chuck Bass wrote: > >> It depends what you are trying to do. >> >> I've looked at what various sites do to prevent autoregistration and >> they use a 'normal' font with a complex background and lines (and >> other geometries) going through the data. Typically the background >> is much bigger than the text. The 'complex' background is quite >> random ususally, in some ways like b/w camoflauge. >> >> Try to register for a yahoo group to see thier method. > > Yes, Chuck, it's cool stuff. I'm dying to try to do something. > > I'm going to use it to block mail, except from humans. I'm tired of > struggling with spam-filter schemes. The problem is that the spammers have found a way around that kind of thing. Here's how: The spammer sets up a free porn site, but to get access to the material, the visitor has to do one of those captcha things. However, its not the site generating the captcha, but the captcha of a DIFFERENT site, such as hotmail or any large scale email system. The human enters the letters, and then the program behind the scene uses that response to 'break through' the captcha system on the target site. Ie, it's using the lure of free stuff to create a distributed captcha-breaking system, using humans as the processing power. However, it'll probably work fine if you're doing something custom, since the spammers aren't going to do all the effort of screen scraping a site with low volume. However, that means you can do just about anything that requires a response, as long as you stay small. If you get big, or the software in use starts to become popular, then the ROI on writing custom code for your particular solution becomes attractive. Its a fun project, though, so don't let the above stop you :) -- ("`-/")_.-'"``-._ Chris Cogdon . . `; -._ )-;-,_`) (v_,)' _ )`-.\ ``-' _.- _..-_/ / ((.' ((,.-' ((,/ fL From smurf at smurf.noris.de Sun Apr 18 23:28:39 2004 From: smurf at smurf.noris.de (Matthias Urlichs) Date: Sun Apr 18 23:32:04 2004 Subject: [Image-SIG] ImageFont on Linux? Was: Hard to OCR font In-Reply-To: References: <20040418174549.76100.qmail@web13907.mail.yahoo.com> Message-ID: <20040419032838.GA8462@kiste> Hi, Marilyn Davis: > I'm going to use it to block mail, except from humans. I'm tired of > struggling with spam-filter schemes. > The problem with all autoresponse systems, these days, is that they generate unsolicited email themselves (because email worms routinely fake sender addresses). There are also problems with header vs. envelope return addresses, neither of which is appropriate for sending such a reply to in all cases. Therefore such replies are very likely to get spamfiltered themselves, particularly if you quote anything from the originating mail -- some Bayes-style filters will have seen your replies to real spam, and thus spam-classified your de-block email itself. NB: Will blind people be able to email you? -- Matthias Urlichs | {M:U} IT Design @ m-u-it.de | smurf@smurf.noris.de From marilyn at deliberate.com Mon Apr 19 02:10:53 2004 From: marilyn at deliberate.com (Marilyn Davis) Date: Mon Apr 19 02:10:57 2004 Subject: [Image-SIG] ImageFont on Linux? Was: Hard to OCR font In-Reply-To: <20040419032838.GA8462@kiste> Message-ID: You guys!!!!! Thanks for all your concerns. I can't do anything until I can load a font. I run a tiny tiny site at deliberate.com. Me, some family, my students, my zen center, some Zapatista and democracy lists -- which can make me a target. But I don't know which addresses, besides mine, will be migrating to the new system: maildance.com. A blind person will have to get help, or call me first. I'm ok with this. Right now, I have: http://www.maildance.com/doorman/dm.py but it's not yet connected to mail. As you can see, the font is lousy. That's why I'm here -- to get help with loading a font on my Linux box. I guess no one here has done it either, eh? Marilyn On Mon, 19 Apr 2004, Matthias Urlichs wrote: > Hi, > > Marilyn Davis: > > I'm going to use it to block mail, except from humans. I'm tired of > > struggling with spam-filter schemes. > > > The problem with all autoresponse systems, these days, is that they > generate unsolicited email themselves (because email worms routinely > fake sender addresses). > > There are also problems with header vs. envelope return addresses, > neither of which is appropriate for sending such a reply to in all > cases. > > Therefore such replies are very likely to get spamfiltered themselves, > particularly if you quote anything from the originating mail -- > some Bayes-style filters will have seen your replies to real spam, and > thus spam-classified your de-block email itself. > > NB: Will blind people be able to email you? > > -- From anthony at interlink.com.au Mon Apr 19 02:15:52 2004 From: anthony at interlink.com.au (Anthony Baxter) Date: Mon Apr 19 02:16:56 2004 Subject: [Image-SIG] ImageFont on Linux? Was: Hard to OCR font In-Reply-To: References: Message-ID: <40836E98.50308@interlink.com.au> Marilyn Davis wrote: > You guys!!!!! > > Thanks for all your concerns. > > I can't do anything until I can load a font. > > I run a tiny tiny site at deliberate.com. Me, some family, my > students, my zen center, some Zapatista and democracy lists -- which > can make me a target. > > But I don't know which addresses, besides mine, will be migrating to > the new system: maildance.com. > > A blind person will have to get help, or call me first. I'm ok with > this. > > Right now, I have: > > http://www.maildance.com/doorman/dm.py > > but it's not yet connected to mail. > > As you can see, the font is lousy. > > That's why I'm here -- to get help with loading a font on my Linux > box. You may want to look at pygame - it can load fonts and generate images just fine. -- Anthony Baxter It's never too late to have a happy childhood. From marilyn at deliberate.com Mon Apr 19 02:25:13 2004 From: marilyn at deliberate.com (Marilyn Davis) Date: Mon Apr 19 02:25:16 2004 Subject: [Image-SIG] ImageFont on Linux? Was: Hard to OCR font In-Reply-To: <40836E98.50308@interlink.com.au> Message-ID: On Mon, 19 Apr 2004, Anthony Baxter wrote: > Marilyn Davis wrote: > > You guys!!!!! > > > > Thanks for all your concerns. > > > > I can't do anything until I can load a font. > > > > I run a tiny tiny site at deliberate.com. Me, some family, my > > students, my zen center, some Zapatista and democracy lists -- which > > can make me a target. > > > > But I don't know which addresses, besides mine, will be migrating to > > the new system: maildance.com. > > > > A blind person will have to get help, or call me first. I'm ok with > > this. > > > > Right now, I have: > > > > http://www.maildance.com/doorman/dm.py > > > > but it's not yet connected to mail. > > > > As you can see, the font is lousy. > > > > That's why I'm here -- to get help with loading a font on my Linux > > box. > > You may want to look at pygame - it can load fonts and generate images > just fine. > Thank you so much! I'll check it out. Marilyn > > > -- From fredrik at pythonware.com Mon Apr 19 02:34:05 2004 From: fredrik at pythonware.com (Fredrik Lundh) Date: Mon Apr 19 02:33:50 2004 Subject: [Image-SIG] Re: Hard to OCR Font References: Message-ID: Marilyn Davis wrote: > I'm once again begging for hints about this. I've googled and googled. > It's been discussed on this list and someone provided a link to some > fonts in .pil, but the link is gone now. the entire X11 font collection is available here: http://effbot.org/downloads/#pilfonts.zip From bali at dkrz.de Mon Apr 19 12:15:48 2004 From: bali at dkrz.de (Manik Bali) Date: Mon Apr 19 12:16:07 2004 Subject: [Image-SIG] Histogram In-Reply-To: Message-ID: Hi ... I have a tiff image file of 16353 rows and 40320 which are uniformly gridded. I want to count the pixels of each type in a gaussian rectangle with pixels which lie on the border be counted as the fraction that is inside the Gaussian grid. Is there a builtin function to do this in pil. Is the histogram overloaded to count fraction of grid bos inside a given rectangle and so on.... Please help Rgds Manik From marilyn at deliberate.com Mon Apr 19 13:55:51 2004 From: marilyn at deliberate.com (Marilyn Davis) Date: Mon Apr 19 13:55:58 2004 Subject: [Image-SIG] Re: Hard to OCR Font In-Reply-To: <200404191727.i3JHRa8x002863@asimov.cfa.harvard.edu> Message-ID: On Mon, 19 Apr 2004, Thomas A. Fine wrote: > Hi, > > I was googling on font info, and came across your recent reference > to myself, in Image-SIG. > > I can't answer questions related to the software you are using. > However, I wanted to comment on the font. I've just finished > a new version of my cursive font. It has three sets of lower > case letters, with no lead-ins, high-attaching lead-ins, and > low-attaching lead-ins. A script can convert text such that it > will have the proper attachments. This makes it both more readable > and harder to OCR. I provide a sample script on the web page > (it's perl; I'm not looking for a perl/python flamefest; perl is > just what I know). > > In addition, my shadow fonts would also be hard to OCR, although > I think they're also harder to read :). I'm actually replacing > my mailtos with links to a CGI that displays a gif image of the > email address; and I started with the shadow font, then switched > to the cursive. > > If you want to forward any of this info that mailing list, that's > fine with me. > > http://hea-www.harvard.edu/~fine/Tech/x11fonts.html > > tom > -- Hi Tom, (My sympathies about perl.) You are so nice to write me. I love your ttf fonts and your web page. It's about the grooviest web site I've ever seen. And, in fact, it was your cursive.bdf from your X11fonts page that broke one PIL function, and your toast.ttf that broke the other. I did load your dnahand.ttf font into PIL on a Windows machine last night and it went in without a snag. This has given me the confidence to maybe look at the PIL code so I can get all your cool ttf fonts happening on my linux box, and help PIL. But Fredrik Lundh just pointed me to some .pil fonts so I might get lazy and use them and move on. I'm going away to Mexico tonight so I will stop thinking about this for a few days. Thank you again for taking the trouble to write. Marilyn Davis From fine at head.cfa.harvard.edu Mon Apr 19 14:05:39 2004 From: fine at head.cfa.harvard.edu (Thomas A. Fine) Date: Mon Apr 19 14:05:44 2004 Subject: [Image-SIG] Re: Hard to OCR Font In-Reply-To: from Marilyn Davis Message-ID: <200404191805.i3JI5dsp002911@asimov.cfa.harvard.edu> Marilyn Davis wrote: > >Hi Tom, > >(My sympathies about perl.) pthththt. :) >You are so nice to write me. I love your ttf fonts and your web page. >It's about the grooviest web site I've ever seen. > >And, in fact, it was your cursive.bdf from your X11fonts page that >broke one PIL function, and your toast.ttf that broke the other. > >I did load your dnahand.ttf font into PIL on a Windows machine last >night and it went in without a snag. This has given me the confidence >to maybe look at the PIL code so I can get all your cool ttf fonts >happening on my linux box, and help PIL. I don't want to take undue credit. Only the BDF fonts are mine; I don't have any ttf fonts. These must come from some other web page. Perhaps you found a nice site that listed lots of links to other font pages? This is an excellent site with tons of font-related links: http://jeff.cs.mcgill.ca/~luc/fonts.html Perhaps this is the fantastic site you are raving about; it isn't mine. If this isn't the site you're raving about it, you should check it out, because it's great. But it still isn't mine. >Thank you again for taking the trouble to write. Random coincidence brought me to your posts on the web. tom From fredrik at pythonware.com Mon Apr 19 14:26:08 2004 From: fredrik at pythonware.com (Fredrik Lundh) Date: Mon Apr 19 14:25:53 2004 Subject: [Image-SIG] Re: Hard to OCR Font References: <200404191805.i3JI5dsp002911@asimov.cfa.harvard.edu> Message-ID: > >And, in fact, it was your cursive.bdf from your X11fonts page that > >broke one PIL function, and your toast.ttf that broke the other. I'm not sure who I'm responding to here, really, but I grabbed a couple of BDF files from Tom's web page, and "pilfont" has no problems con- verting them to PIL's bitmap format. however, I see that there has been some changes since 1.1.4; to make sure you're using the same code as I use, grab the BdfFontFile.py module from the 1.1.5a2 release: http://www.effbot.org/downloads/#Imaging From marilyn at deliberate.com Mon Apr 19 14:35:04 2004 From: marilyn at deliberate.com (Marilyn Davis) Date: Mon Apr 19 14:35:36 2004 Subject: [Image-SIG] Re: Hard to OCR Font In-Reply-To: Message-ID: Tom Fine just wrote me that I was mistaken here: > I love your ttf fonts and your web page. He hasn't made any ttf fonts. He did make the .bdf fonts. The groovy page with cute .ttf fonts is from Tom Murphy: http://fonts.tom7.com/ Excuse me Toms. Marilyn From marilyn at deliberate.com Mon Apr 19 14:36:31 2004 From: marilyn at deliberate.com (Marilyn Davis) Date: Mon Apr 19 14:36:35 2004 Subject: [Image-SIG] Re: Hard to OCR Font In-Reply-To: Message-ID: Thank you again. I look forward to trying it when I get back from my vacation. Marilyn On Mon, 19 Apr 2004, Fredrik Lundh wrote: > > >And, in fact, it was your cursive.bdf from your X11fonts page that > > >broke one PIL function, and your toast.ttf that broke the other. > > I'm not sure who I'm responding to here, really, but I grabbed a couple > of BDF files from Tom's web page, and "pilfont" has no problems con- > verting them to PIL's bitmap format. > > however, I see that there has been some changes since 1.1.4; to make > sure you're using the same code as I use, grab the BdfFontFile.py module > from the 1.1.5a2 release: > > http://www.effbot.org/downloads/#Imaging > > > > > > > _______________________________________________ > Image-SIG maillist - Image-SIG@python.org > http://mail.python.org/mailman/listinfo/image-sig > -- From claw at kanga.nu Tue Apr 20 12:20:15 2004 From: claw at kanga.nu (J C Lawrence) Date: Tue Apr 20 12:20:19 2004 Subject: [Image-SIG] setup.py incompleat support of distutils Message-ID: <28690.1082478015@kanga.nu> The Python-pil 1.1.4 installer does not compleatly support distutils. Specifically (in my case) it wouldn't accept a `--prefix=/foo" command line argument to control the installation location. Adding: import distutils to setup.py fixed this. -- J C Lawrence ---------(*) Satan, oscillate my metallic sonatas. claw@kanga.nu He lived as a devil, eh? http://www.kanga.nu/~claw/ Evil is a name of a foeman, as I live. From fredrik at pythonware.com Tue Apr 20 13:28:00 2004 From: fredrik at pythonware.com (Fredrik Lundh) Date: Tue Apr 20 13:27:44 2004 Subject: [Image-SIG] Re: setup.py incompleat support of distutils References: <28690.1082478015@kanga.nu> Message-ID: J C Lawrence wrote: > The Python-pil 1.1.4 installer does not compleatly support distutils. > Specifically (in my case) it wouldn't accept a `--prefix=/foo" command > line argument to control the installation location. Adding: > > import distutils > > to setup.py fixed this. hmm. that sure sounds like a bug in distutils (or in the documentation; all examples use "from distutils.core import ..." which is exactly how it's done in PIL's setup file). anyway, I'll look into it. thanks /F From putanowr at twins.pk.edu.pl Wed Apr 21 06:35:54 2004 From: putanowr at twins.pk.edu.pl (Roman Putanowicz) Date: Wed Apr 21 06:36:04 2004 Subject: [Image-SIG] Problem with eps Message-ID: <20040421103554.GA13195@twins.pk.edu.pl> Hi All, I looked at few recent messages but I could not search the archive so please excuse me if this problem was already posted. I have a problem with loading a eps file (in attachment) (python 2.2.1, PIL 1.1.4) The following script import Image im = Image.open('a.eps') im.load() print im.getbbox() Fails with the message: Traceback (most recent call last): File "ala.py", line 3, in ? im.load() File "/opt/lib/python2.2/site-packages/PIL/EpsImagePlugin.py", line 282, in load self.im = Ghostscript(self.tile, self.size, self.fp) File "/opt/lib/python2.2/site-packages/PIL/EpsImagePlugin.py", line 75, in Ghostscript im = Image.core.open_ppm(file) IOError: error when accessing file Looking at the code I discovered that gs wasn't producing any output for my file and went to an empirical fix: in EpsImagePlugin.py in function Ghostscript I added the command to write 'showpage' at the end of the input (see the attachment). Can somebody with more postscript knowledge confirm that this was a bug and that the fix is all right ? Thanks in advance Romek -- _/_/_/ _/ _/ _/_/_/_/_/ Roman Putanowicz _/ _/ _/ _/ Inst.Comp.Meth.Civ.Eng. _/ _/ _/ _/ tel +48 12 628 2569 _/_/_/racow _/_/_/niversity of _/echnology putanowr@twins.pk.edu.pl -------------- next part -------------- A non-text attachment was scrubbed... Name: a.eps Type: application/postscript Size: 3245 bytes Desc: not available Url : http://mail.python.org/pipermail/image-sig/attachments/20040421/70e66c8e/a.eps -------------- next part -------------- def Ghostscript(tile, size, fp): """Render an image using Ghostscript (Unix only)""" # Unpack decoder tile decoder, tile, offset, data = tile[0] length, bbox = data import tempfile, os file = tempfile.mktemp() # Build ghostscript command command = ["gs", "-q", # quite mode "-g%dx%d" % size, # set output geometry (pixels) "-dNOPAUSE -dSAFER", # don't pause between pages, safe mode "-sDEVICE=ppmraw", # ppm driver "-sOutputFile=%s" % file,# output file "- >/dev/tty 2>/dev/tty"] command = string.join(command) # push data through ghostscript try: gs = os.popen(command, "w") # adjust for image origin if bbox[0] != 0 or bbox[1] != 0: gs.write("%d %d translate\n" % (-bbox[0], -bbox[1])) fp.seek(offset) while length > 0: s = fp.read(8192) if not s: break length = length - len(s) gs.write(s) # FIX for problems with no output from gs gs.write("showpage") gs.close() im = Image.core.open_ppm(file) finally: try: os.unlink(file) except: pass return im From ahatzis at ithcorp.com Wed Apr 21 07:02:07 2004 From: ahatzis at ithcorp.com (Anastasios Hatzis) Date: Wed Apr 21 06:43:28 2004 Subject: [Image-SIG] How to open image file via HTTP and save locally? Message-ID: <1082545326.2717.14.camel@eos.WorkGroup> I want my Python script to read a remote image file on a web server (e.g. JPG) and then save it locally. I imported PIL 1.1.4 on my Python 2.3.2 (Windows XP) and everything works fine while I read locally stored image files, using the PIL. But I can't find an example or description, how to open an image file, if it is not local but on a remote Web server ... - neither in PIL handbook, Python website, nor in various mailing archives. Does anyone know how to solve this problem? If needed, I can provide the various source codes, which I tried, and didn't work. Thanks for your help. Anastasios http://freegee.sourceforge.net/ http://www.go-gen.com/ From fredrik at pythonware.com Wed Apr 21 07:08:16 2004 From: fredrik at pythonware.com (Fredrik Lundh) Date: Wed Apr 21 07:08:32 2004 Subject: [Image-SIG] Re: How to open image file via HTTP and save locally? References: <1082545326.2717.14.camel@eos.WorkGroup> Message-ID: Anastasios Hatzis wrote: > I want my Python script to read a remote image file on a web server > (e.g. JPG) and then save it locally. > > I imported PIL 1.1.4 on my Python 2.3.2 (Windows XP) and everything > works fine while I read locally stored image files, using the PIL. > > But I can't find an example or description, how to open an image file, > if it is not local but on a remote Web server ... > - neither in PIL handbook, Python website, nor in various mailing > archives. if you want PIL to open the file from the web: import urllib import Image im = Image.open(urllib.urlopen(URL)) if you just want to download the file to a local directory: import urllib urllib.urlretrieve(URL, FILENAME) see also: http://www.python.org/doc/current/lib/module-urllib.html http://effbot.org/zone/pil-image-size.htm From William.T.Bridgman.1 at gsfc.nasa.gov Wed Apr 21 09:02:59 2004 From: William.T.Bridgman.1 at gsfc.nasa.gov (W.T. Bridgman) Date: Wed Apr 21 09:08:08 2004 Subject: [Image-SIG] Re: setup.py incompleat support of distutils In-Reply-To: References: <28690.1082478015@kanga.nu> Message-ID: <37371420-9394-11D8-9DB6-0030657B87AC@gsfc.nasa.gov> This is interesting because I've had to do exactly this to get the PyXML 0.8+ modules to build in the default location on OS X. Not sure if it's related but it might provide some insight. Tom On Apr 20, 2004, at 1:28 PM, Fredrik Lundh wrote: > J C Lawrence wrote: > >> The Python-pil 1.1.4 installer does not compleatly support distutils. >> Specifically (in my case) it wouldn't accept a `--prefix=/foo" command >> line argument to control the installation location. Adding: >> >> import distutils >> >> to setup.py fixed this. > > hmm. that sure sounds like a bug in distutils (or in the > documentation; all > examples use "from distutils.core import ..." which is exactly how > it's done > in PIL's setup file). > > anyway, I'll look into it. > > thanks /F > > > > > _______________________________________________ > Image-SIG maillist - Image-SIG@python.org > http://mail.python.org/mailman/listinfo/image-sig > > -- *********************************************************************** **** NOTE NEW EMAIL ADDRESS AS THE WYETH ADDRESS WILL GO AWAY SOON **** *********************************************************************** Dr. William T."Tom" Bridgman Scientific Visualization Studio Global Science & Technology, Inc. NASA/Goddard Space Flight Center Email: William.T.Bridgman.1@gsfc.nasa.gov Code 935 Phone: 301-286-1346 Greenbelt, MD 20771 FAX: TBD http://svs.gsfc.nasa.gov/ From fredrik at pythonware.com Wed Apr 21 09:17:14 2004 From: fredrik at pythonware.com (Fredrik Lundh) Date: Wed Apr 21 09:17:19 2004 Subject: [Image-SIG] Re: Problem with eps References: <20040421103554.GA13195@twins.pk.edu.pl> Message-ID: Roman Putanowicz wrote: > Looking at the code I discovered that gs wasn't producing any output > for my file and went to an empirical fix: > in EpsImagePlugin.py in function Ghostscript I added > the command to write 'showpage' at the end of the input > (see the attachment). > > Can somebody with more postscript knowledge confirm that this was a bug > and that the fix is all right ? EPS files may or may not contain a "showpage" command (iirc, it used to be recommended, but I may be mistaken). the right way to do this is to install a dummy "showpage" before rendering the file, and call the real one afterwards. I'll look into this for 1.1.5. thanks /F From fredrik at pythonware.com Wed Apr 21 09:36:40 2004 From: fredrik at pythonware.com (Fredrik Lundh) Date: Wed Apr 21 09:36:48 2004 Subject: [Image-SIG] Re: Histogram References: Message-ID: Manik Bali wrote: > I have a tiff image file of 16353 rows and 40320 which are uniformly > gridded. > I want to count the pixels of each type in a gaussian rectangle with > pixels which lie on the border be counted as the fraction that is inside > the Gaussian grid. > Is there a builtin function to do this in pil. Is the histogram overloaded > to count fraction of grid bos inside a given rectangle and so on.... do you want to generate histograms for parts of the image, and treat edge pixels as "fractions"? that is, if an edge pixel covers 50% of an image pixel with the value 86, treat it as if it had value 43? one way to do this is to use "crop" to cut out a rectangle, use ImageChops.multiply() to multiply the rectangle with a precalculated mask (where 1.0 is mapped to 255), and then calculate a histogram of the result: width, height = size of region mask = Image.new("L", (width, height)) ... initialize mask ... for x, y in list of positions: region = im.crop((x, y, x+width, y+height)) region = ImageChops.multiply(region, mask) histogram = region.histogram() ... hope this helps! From chris at cogdon.org Wed Apr 21 11:09:11 2004 From: chris at cogdon.org (Chris Cogdon) Date: Wed Apr 21 11:09:25 2004 Subject: [Image-SIG] How to open image file via HTTP and save locally? In-Reply-To: <1082545326.2717.14.camel@eos.WorkGroup> References: <1082545326.2717.14.camel@eos.WorkGroup> Message-ID: On Apr 21, 2004, at 04:02, Anastasios Hatzis wrote: > I want my Python script to read a remote image file on a web server > (e.g. JPG) and then save it locally. > > I imported PIL 1.1.4 on my Python 2.3.2 (Windows XP) and everything > works fine while I read locally stored image files, using the PIL. > > But I can't find an example or description, how to open an image file, > if it is not local but on a remote Web server ... > - neither in PIL handbook, Python website, nor in various mailing > archives. > > Does anyone know how to solve this problem? If needed, I can provide > the > various source codes, which I tried, and didn't work. Read the docs for the urllib module. -- ("`-/")_.-'"``-._ Chris Cogdon . . `; -._ )-;-,_`) (v_,)' _ )`-.\ ``-' _.- _..-_/ / ((.' ((,.-' ((,/ fL From lysdexia at crackrabbit.com Wed Apr 21 13:24:13 2004 From: lysdexia at crackrabbit.com (Douglas Shawhan) Date: Wed Apr 21 13:24:16 2004 Subject: [Image-SIG] 1.1.5a2 breakage on Fedora Core 2 Message-ID: <20040421172413.6D67AEBD7E@vulcan.rootr.net> Hi folks, I am getting the following error when attempting to build 1.1.5a2 on Fedora Core 2. running build_ext building '_imagingft' extension gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -march=i386 -mcpu=i686 -D_GNU_SOURCE -fPIC -fPIC -IlibImaging -I/usr/include/freetype2 -I/usr/include/python2.3 -c _imagingft.c -o build/temp.linux-i686-2.3/_imagingft.o _imagingft.c:19:24: : No such file or directory _imagingft.c:20:25: FT_FREETYPE_H: No such file or directory In file included from _imagingft.c:22: /usr/include/freetype2/freetype/freetype.h:20:2: #error "`ft2build.h' hasn't been included yet!" /usr/include/freetype2/freetype/freetype.h:21:2: #error "Please always use macros to include FreeType header files." /usr/include/freetype2/freetype/freetype.h:22:2: #error "Example:" /usr/include/freetype2/freetype/freetype.h:23:2: #error " #include " /usr/include/freetype2/freetype/freetype.h:24:2: #error " #include FT_FREETYPE_H" error: command 'gcc' failed with exit status 1 I have added and FT_FREETYPE_H to _imagingft.c, with zero joy. Suggestions? From lysdexia at crackrabbit.com Wed Apr 21 13:36:29 2004 From: lysdexia at crackrabbit.com (lysdexia@crackrabbit.com) Date: Wed Apr 21 13:38:42 2004 Subject: [Image-SIG] compiling Imaging-1.1.4 without tk support Message-ID: <4086B11D.1020601@crackrabbit.com> Howdy, I am also attempting to compile 1.1.4 (one of these rascals has to work!) on fedora core 2. I am not planning on using tkinter for anything and that seems to be where the setup.py is breaking. Is there a --no_stanking_Tk_Please type argument I can pass to configure? Thanks! Doug From fredrik at pythonware.com Wed Apr 21 13:44:37 2004 From: fredrik at pythonware.com (Fredrik Lundh) Date: Wed Apr 21 13:44:22 2004 Subject: [Image-SIG] Re: compiling Imaging-1.1.4 without tk support References: <4086B11D.1020601@crackrabbit.com> Message-ID: Doug wrote: > I am also attempting to compile 1.1.4 (one of these rascals has to > work!) on fedora core 2. > > I am not planning on using tkinter for anything and that seems to be > where the setup.py is breaking. Is there a --no_stanking_Tk_Please type > argument I can pass to configure? the setup.py file is pure Python, and easy to hack to suit your needs. changing "import _tkinter" to "import no_stanking_tkinter_please" should do the trick. From anthony at interlink.com.au Thu Apr 22 03:54:54 2004 From: anthony at interlink.com.au (Anthony Baxter) Date: Thu Apr 22 04:31:51 2004 Subject: [Image-SIG] 1.1.5a2 breakage on Fedora Core 2 In-Reply-To: <20040421172413.6D67AEBD7E@vulcan.rootr.net> References: <20040421172413.6D67AEBD7E@vulcan.rootr.net> Message-ID: <40877A4E.10308@interlink.com.au> Douglas Shawhan wrote: > Hi folks, > I am getting the following error when attempting to build 1.1.5a2 on > Fedora Core 2. > running build_ext > building '_imagingft' extension > gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -march=i386 > -mcpu=i686 -D_GNU_SOURCE -fPIC -fPIC -IlibImaging > -I/usr/include/freetype2 -I/usr/include/python2.3 -c _imagingft.c -o > build/temp.linux-i686-2.3/_imagingft.o > _imagingft.c:19:24: : No such file or directory > _imagingft.c:20:25: FT_FREETYPE_H: No such file or directory > I have added and FT_FREETYPE_H to _imagingft.c, with zero joy. > Suggestions? Install the freetype-devel RPM, not just the freetype RPM. From ahatzis at ithcorp.com Thu Apr 22 08:48:46 2004 From: ahatzis at ithcorp.com (Anastasios Hatzis) Date: Thu Apr 22 08:29:53 2004 Subject: [Image-SIG] Re: How to open image file via HTTP and save locally? In-Reply-To: References: <1082545326.2717.14.camel@eos.WorkGroup> Message-ID: <1082638125.2504.10.camel@eos.WorkGroup> On Wed, 2004-04-21 at 13:08, Fredrik Lundh wrote: > Anastasios Hatzis wrote: > > > I want my Python script to read a remote image file on a web server > > (e.g. JPG) and then save it locally. > > > > I imported PIL 1.1.4 on my Python 2.3.2 (Windows XP) and everything > > works fine while I read locally stored image files, using the PIL. > > > > But I can't find an example or description, how to open an image file, > > if it is not local but on a remote Web server ... > > - neither in PIL handbook, Python website, nor in various mailing > > archives. > > if you want PIL to open the file from the web: > > import urllib > import Image > > im = Image.open(urllib.urlopen(URL)) > > if you just want to download the file to a local directory: > > import urllib > urllib.urlretrieve(URL, FILENAME) > > see also: > > http://www.python.org/doc/current/lib/module-urllib.html > http://effbot.org/zone/pil-image-size.htm > > > Thank you for your help. Example 2 worked as described. And on your recommended effbot-link I found the information how to check size before downloading the image. An error occured at example 1 (see below), that I could solve with a suggestion of Steve Holden on http://mail.python.org/pipermail/python-list/2001-October/067726.html I attached the error message and the solution below, so other users may find it on this list, if they got same problem. Anastasios === Error of Example 2: Traceback (most recent call last): File "F:\PYfiles\example1.py", line 4, in -toplevel- im = Image.open(urllib.urlopen('http://freegee.sourceforge.net/FG_EN/src/teasers_en/t_gee-power_en.gif')) File "F:\Python23\lib\site-packages\PIL\Image.py", line 1555, in open fp.seek(0) AttributeError: addinfourl instance has no attribute 'seek' === Example Solution: #example2.py import cStringIO # *much* faster than StringIO import urllib import Image file = urllib.urlopen('http://freegee.sourceforge.net/FG_EN/src/teasers_en/t_gee-power_en.gif') im = cStringIO.StringIO(file.read()) # constructs a StringIO holding the image img = Image.open(im) # now use PIL print img.format, img.size, img.mode img.save('my_copy.gif') # delete img if you need to save space and work on large images del img From rbrendler at InterfaceSoftware.com Thu Apr 22 12:24:26 2004 From: rbrendler at InterfaceSoftware.com (Brendler, Ralph) Date: Thu Apr 22 12:25:33 2004 Subject: [Image-SIG] Debugging PIL in Win32? Message-ID: <5E0F00514E86B04E94EC2836AD58B89E02904806@postoffice.interfacesoftware.com> I am trying to track down a segfault in the Win32 version of PIL while showing group4 TIFF images (Linux works fine). The stack trace indicates the fault is in the imaging library, but without debug information I am not sure where. Hence, my issue: How do I go about creating a debug version of the _imaging module in Win32? I have tweaked the individual makefiles to get all components compiling for debug in Win32, and it still is having problems. The PIL code is straight 1.1.4 plus the July patch for Group4 support. I have built debug versions of Python, Tcl, Tk, libtiff, libjpeg, and zlib, and created _imaging_d and _imagingtk_d libraries that load properly under python_d. As far as I can tell everything appears to be compiled with the same options, but I am getting an heap validation error (which usually indicates a debug/nondebug difference in libraries) when calling ImagingLibTiffCleanup. Anyone have any hints, or better yet a working dsw for PIL and all of its components? From vpastukhov at naumen.ru Thu Apr 22 18:09:57 2004 From: vpastukhov at naumen.ru (Vladimir Pastukhov) Date: Thu Apr 22 18:10:50 2004 Subject: [Image-SIG] Debugging PIL in Win32? In-Reply-To: <5E0F00514E86B04E94EC2836AD58B89E02904806@postoffice.interfacesoftware.com> References: <5E0F00514E86B04E94EC2836AD58B89E02904806@postoffice.interfacesoftware.com> Message-ID: <408842B5.3020905@naumen.ru> Hello, Brendler, Ralph wrote: > The PIL code is straight 1.1.4 plus the July patch for Group4 support. BTW, next month I plan to release a new patch that will not use internal libtiff structures access (requires some additions to libtiff API, which are settling). This should resolve build and compatibility problems as yours. > As far as I can tell everything appears to be compiled with the same options, but I am getting an heap validation error (which usually indicates a debug/nondebug difference in libraries) when calling ImagingLibTiffCleanup. Looks like different optimizations are used for the libImaging library and for the Python extension itself. Try checking CFLAGS in libImaging/ Makefile.win and the options setup.py uses to compile decode.c -- Best regards, Vladimir vpastukhov@naumen.ru From vpastukhov at naumen.ru Sat Apr 24 04:12:43 2004 From: vpastukhov at naumen.ru (Vladimir Pastukhov) Date: Sat Apr 24 07:37:19 2004 Subject: [Image-SIG] Debugging PIL in Win32? In-Reply-To: <5E0F00514E86B04E94EC2836AD58B89E0290480B@postoffice.interfacesoftware.com> References: <5E0F00514E86B04E94EC2836AD58B89E0290480B@postoffice.interfacesoftware.com> Message-ID: <408A217B.6010701@naumen.ru> Hello, Brendler, Ralph wrote: > Thanks for the input. I anxiously await the new library! Any idea when this will become part of the standard PIL release? This depends on PIL guys. Currently I am using PIL 1.1.5-alpha for development and going to make it ready for the 1.1.5 release. > I deal mostly with TIFFs from the US Patent Office (all group4 encoded), so I was thrilled when you added this support to PIL. I was hoping to repay you by tracking down this segfault, but this one has me completely stymied. > > I have validated the compilation flags on all of my libraries, and everything seems to be correct, but I am still getting the heap violation from libTiff. This one really has me stumped. It looks like *someone* is setting DEBUG_NEW (adds some marker bytes around the allocation to flag memory bugs), but I can't find this anywhere. What C compiler are you using? I've built it with Visual C++ 6 without any special settings. > Any other suggestions? I am moving forward with my development on Linux, but eventually I will need this to work on Win32... I've attached Win32 binary to a separate letter, so far had no problems with it. > > I appreciate your help. > > -----Original Message----- > From: Vladimir Pastukhov [mailto:vpastukhov@naumen.ru] > Sent: Thursday, April 22, 2004 5:10 PM > To: Brendler, Ralph > Cc: image-sig@python.org > Subject: Re: [Image-SIG] Debugging PIL in Win32? > > > Hello, > > Brendler, Ralph wrote: > >>The PIL code is straight 1.1.4 plus the July patch for Group4 support. > > > BTW, next month I plan to release a new patch that will not use > internal libtiff structures access (requires some additions to libtiff > API, which are settling). This should resolve build and compatibility > problems as yours. > > >>As far as I can tell everything appears to be compiled with the same options, but I am getting an heap validation error (which usually indicates a debug/nondebug difference in libraries) when calling ImagingLibTiffCleanup. > > > Looks like different optimizations are used for the libImaging library > and for the Python extension itself. Try checking CFLAGS in libImaging/ > Makefile.win and the options setup.py uses to compile decode.c > -- Vladimir Pastukhov From dpimw at opti.cgi.net Sat Apr 24 12:52:23 2004 From: dpimw at opti.cgi.net (Dan West) Date: Sat Apr 24 12:47:50 2004 Subject: [Image-SIG] Creating Palettes Message-ID: <5.2.1.1.2.20040424113313.031c5ec8@mail.pyxos.com> I'm using PIL to create GIF images on my server based on a user's specificiations. I need to be able to create small and optimized GIF images by using a optimized palette of 32 or 64 colors. PIL's palette support seems to be very limited. How can I get it to optimize a palette for me? -Dan From kent at springfed.com Sat Apr 24 15:43:56 2004 From: kent at springfed.com (Kent Tenney) Date: Sat Apr 24 15:48:58 2004 Subject: [Image-SIG] Embedding text in image files Message-ID: <408AC37C.6080702@springfed.com> Howdy, I'm using PIL 1.1.5a1 with Python 2.3.3 on Windows, and would like to put textual information in image files. What options are available for writing text to jpeg, gif and png ? Thanks, Kent From b.preusing at web.de Sun Apr 25 02:25:50 2004 From: b.preusing at web.de (Bernd Preusing) Date: Sun Apr 25 02:26:40 2004 Subject: [Image-SIG] Embedding text in image files In-Reply-To: <408AC37C.6080702@springfed.com> References: <408AC37C.6080702@springfed.com> Message-ID: On Sat, 24 Apr 2004 14:43:56 -0500, Kent Tenney wrote: > Howdy, > > I'm using PIL 1.1.5a1 with Python 2.3.3 on Windows, > and would like to put textual information in > image files. > > What options are available for writing > text to jpeg, gif and png ? Hiho, what do you mean by "options"? IMHO the simplest way is something like this: from PIL import ImageDraw, ImageFont # input: img, fontPath, text1 font1 = ImageFont.load(fontPath) draw1 = ImageDraw.Draw(img) tSizeX, tSizeY = draw1.textsize(text, font=font1) # calculate x and y... draw.text((x, y), text1, font=font1, fill='#000000') ... save img I have used this with PIL 1.1.4 only. To my experience text looks nicer on RGB images (jpeg), so I convert palette images to RGB before placing objects. If you want more complex effects like shadow text or transparent text, take a look at the filters page and source code of PyAlbum http://pyalbum.sourceforge.net/Filters.html Best regards Bernd From kent at springfed.com Sun Apr 25 06:04:08 2004 From: kent at springfed.com (Kent Tenney) Date: Sun Apr 25 06:09:41 2004 Subject: [Image-SIG] Embedding text in image files In-Reply-To: References: <408AC37C.6080702@springfed.com> Message-ID: <408B8D18.9050602@springfed.com> Sorry, I didn't make myself clear. By "options" I mean things like EXIF, IPTC, jpeg comments ... I want to store text (data) in the file, not the image. Thanks, Kent Bernd Preusing wrote: > On Sat, 24 Apr 2004 14:43:56 -0500, Kent Tenney wrote: > >> Howdy, >> >> I'm using PIL 1.1.5a1 with Python 2.3.3 on Windows, >> and would like to put textual information in >> image files. >> >> What options are available for writing >> text to jpeg, gif and png ? > > > Hiho, > > what do you mean by "options"? > > IMHO the simplest way is something like this: > > from PIL import ImageDraw, ImageFont > # input: img, fontPath, text1 > font1 = ImageFont.load(fontPath) > draw1 = ImageDraw.Draw(img) > tSizeX, tSizeY = draw1.textsize(text, font=font1) > # calculate x and y... > draw.text((x, y), text1, font=font1, fill='#000000') > ... save img > > I have used this with PIL 1.1.4 only. > To my experience text looks nicer on RGB images > (jpeg), so I convert palette images to RGB before > placing objects. > > If you want more complex effects like shadow text > or transparent text, take a look at the filters page > and source code of PyAlbum http://pyalbum.sourceforge.net/Filters.html > > Best regards > Bernd > > _______________________________________________ > Image-SIG maillist - Image-SIG@python.org > http://mail.python.org/mailman/listinfo/image-sig > > From b.preusing at web.de Sun Apr 25 12:19:47 2004 From: b.preusing at web.de (Bernd Preusing) Date: Sun Apr 25 12:19:56 2004 Subject: [Image-SIG] Embedding text in image files In-Reply-To: <408B8D18.9050602@springfed.com> References: <408AC37C.6080702@springfed.com> <408B8D18.9050602@springfed.com> Message-ID: On Sun, 25 Apr 2004 05:04:08 -0500, Kent Tenney wrote: Ok, sorry.... in that case I have the exact same problem, plus losless rotation (no loss of EXIF, IPTC and image information itself). JPEG images opened and saved with PIL tend to be much smaller than the originals, I believe according higher compression. > Sorry, I didn't make myself clear. > > By "options" I mean things like > EXIF, IPTC, jpeg comments ... > > I want to store text (data) in the file, > not the image. > > Thanks, > Kent > > > > Bernd Preusing wrote: > >> On Sat, 24 Apr 2004 14:43:56 -0500, Kent Tenney >> wrote: >> >>> Howdy, >>> >>> I'm using PIL 1.1.5a1 with Python 2.3.3 on Windows, >>> and would like to put textual information in >>> image files. >>> >>> What options are available for writing >>> text to jpeg, gif and png ? >> >> >> Hiho, >> >> what do you mean by "options"? >> >> IMHO the simplest way is something like this: >> >> from PIL import ImageDraw, ImageFont >> # input: img, fontPath, text1 >> font1 = ImageFont.load(fontPath) >> draw1 = ImageDraw.Draw(img) >> tSizeX, tSizeY = draw1.textsize(text, font=font1) >> # calculate x and y... >> draw.text((x, y), text1, font=font1, fill='#000000') >> ... save img >> >> I have used this with PIL 1.1.4 only. >> To my experience text looks nicer on RGB images >> (jpeg), so I convert palette images to RGB before >> placing objects. >> >> If you want more complex effects like shadow text >> or transparent text, take a look at the filters page >> and source code of PyAlbum http://pyalbum.sourceforge.net/Filters.html >> >> Best regards >> Bernd >> >> _______________________________________________ >> Image-SIG maillist - Image-SIG@python.org >> http://mail.python.org/mailman/listinfo/image-sig >> >> > > _______________________________________________ > Image-SIG maillist - Image-SIG@python.org > http://mail.python.org/mailman/listinfo/image-sig > -- Bernd Preusing mailto://b.preusing@web.de From FeliciaBubis at coates-4.freeserve.co.uk Sun Apr 25 18:35:31 2004 From: FeliciaBubis at coates-4.freeserve.co.uk (Bradford Schulhof) Date: Sun Apr 25 16:15:59 2004 Subject: [Image-SIG] Hot Sale on all AutoCAD products at Amado's Softshop Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20040425/533a0170/attachment.html From u+pil at lysator.liu.se Sun Apr 25 17:11:26 2004 From: u+pil at lysator.liu.se (Ulrik Svensson) Date: Sun Apr 25 17:11:33 2004 Subject: [Image-SIG] TIF image with jpeg-compression error Message-ID: <1082927486.2944.6.camel@f134.ryd.student.liu.se> Hi! PIL 1.1.4 (Debian package ver 1.1.4-3) does not seem to handle a tif-image with jpeg-compression, created with GIMP. The test image is attached. /Ulrik Svensson Python 2.3.3 (#2, Feb 24 2004, 09:29:20) [GCC 3.3.3 (Debian)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import Image >>> Image.open("test-jpeg.tif").load() Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.3/site-packages/PIL/ImageFile.py", line 165, in load d = Image._getdecoder(self.mode, d, a, self.decoderconfig) File "/usr/lib/python2.3/site-packages/PIL/Image.py", line 307, in _getdecoder return apply(decoder, (mode,) + args + extra) TypeError: function takes at least 3 arguments (2 given) -------------- next part -------------- A non-text attachment was scrubbed... Name: test-jpeg.tif.gz Type: application/x-gzip Size: 1830 bytes Desc: not available Url : http://mail.python.org/pipermail/image-sig/attachments/20040425/962d3377/test-jpeg.tif-0001.gz From fredrik at pythonware.com Mon Apr 26 05:10:34 2004 From: fredrik at pythonware.com (Fredrik Lundh) Date: Mon Apr 26 05:11:30 2004 Subject: [Image-SIG] Re: TIF image with jpeg-compression error References: <1082927486.2944.6.camel@f134.ryd.student.liu.se> Message-ID: Ulrik Svensson wrote: > PIL 1.1.4 (Debian package ver 1.1.4-3) does not seem to handle a > tif-image with jpeg-compression, created with GIMP. The test image is > attached. I've attached a patch. thanks /F Index: PIL/TiffImagePlugin.py =================================================================== --- PIL/TiffImagePlugin.py (revision 1785) +++ PIL/TiffImagePlugin.py (working copy) @@ -472,14 +472,19 @@ args = None if rawmode == "RGB" and self._planar_configuration == 2: rawmode = rawmode[layer] - if self._compression == "raw": + compression = self._compression + if compression == "raw": args = (rawmode, 0, 1) - if self._compression in ["packbits", "tiff_lzw", "jpeg"]: - args = rawmode - if self._compression == "jpeg" and self.tag.has_key(JPEGTABLES): + elif compression == "jpeg": + args = rawmode, "" + if self.tag.has_key(JPEGTABLES): # Hack to handle abbreviated JPEG headers self.tile_prefix = self.tag[JPEGTABLES] - elif self._compression == "tiff_lzw" and self.tag.has_key(317): + elif compression == "packbits": + args = rawmode + elif compression == "tiff_lzw": + args = rawmode + if self.tag.has_key(317): # Section 14: Differencing Predictor self.decoderconfig = (self.tag[PREDICTOR][0],) From marilyn at deliberate.com Mon Apr 26 13:26:04 2004 From: marilyn at deliberate.com (Marilyn Davis) Date: Mon Apr 26 13:26:13 2004 Subject: [Image-SIG] Re: Hard to OCR Font In-Reply-To: Message-ID: On Mon, 19 Apr 2004, Fredrik Lundh wrote: > > >And, in fact, it was your cursive.bdf from your X11fonts page that > > >broke one PIL function, and your toast.ttf that broke the other. > > I'm not sure who I'm responding to here, really, but I grabbed a couple > of BDF files from Tom's web page, and "pilfont" has no problems con- > verting them to PIL's bitmap format. OK. I see my problem. "pilfont" works just fine. I was trying to use "bdf2pil.py". So, maybe I'm on the road now. Thank you so much. > > however, I see that there has been some changes since 1.1.4; to make > sure you're using the same code as I use, grab the BdfFontFile.py module > from the 1.1.5a2 release: I am now using the 1.1.5a2. But pilfont seems to work just fine on the older release too. Again, thank you so much, and especially for the wonderful software. Marilyn > > http://www.effbot.org/downloads/#Imaging > > > > > > > _______________________________________________ > Image-SIG maillist - Image-SIG@python.org > http://mail.python.org/mailman/listinfo/image-sig > -- From plucker-dev-admin at rubberchicken.org Mon Apr 26 13:31:04 2004 From: plucker-dev-admin at rubberchicken.org (plucker-dev-admin@rubberchicken.org) Date: Mon Apr 26 13:31:29 2004 Subject: [Image-SIG] Your message to plucker-dev awaits moderator approval Message-ID: <20040426173104.15851.15206.Mailman@ike.inomial.com> Your mail to 'plucker-dev' with the subject Delivery failure notice (ID-00007A62) Is being held until the list moderator can review it for approval. The reason it is being held: Post by non-member to a members-only list Either the message will get posted to the list, or you will receive notification of the moderator's decision. From ljkdy at artdifusion.com Mon Apr 26 04:30:09 2004 From: ljkdy at artdifusion.com (Marlow Hanula) Date: Tue Apr 27 01:44:05 2004 Subject: [Image-SIG] Moore 77 it.ms ava.laBle online chemist's shop Message-ID: <6464182373.20040425213015@@artdifusion.com> My dear colleague ... Cialiis readily availablle, no recipe needed !! Ciaalis this is new imppotence drugg. Cialiis acts in the same way as Viaagra. We have lowest priice ! Up to 85 % of patients who take Cialiis experience an improovemeent in their erections. Wherefore chooose our company ?? - Low prices for Generic Medications http://bestforyour.biz/%73v/in%64%65%78%2e%70hp?%70%69d=%65va%70%68%33%3839 Know as much as possible about us ... Let try it! From klanten-service at large.nl Fri Apr 30 02:51:51 2004 From: klanten-service at large.nl (Klanten.Service) Date: Fri Apr 30 02:51:45 2004 Subject: [Image-SIG] Re: Important Message-ID: <200404300651.i3U6ppS02473@mail.large.nl> Beste klant, Wij hebben je mail ontvangen en zullen zo spoedig mogelijk antwoord geven op je vraag. Door drukte kan het soms enkele dagen duren eer je een antwoord krijgt. Large Klantenservice. From hassan at dotfunk.com Fri Apr 30 14:20:43 2004 From: hassan at dotfunk.com (hassan@dotfunk.com) Date: Fri Apr 30 14:20:55 2004 Subject: [Image-SIG] Writing an AVI file Message-ID: Does anyone have a good python module to write AVI files on Windows from a bunch of images? Thanks, Scott