From thomasj at eworld.hu Mon Jan 3 15:34:40 2005 From: thomasj at eworld.hu (Tamas J) Date: Mon Jan 3 15:34:47 2005 Subject: [Image-SIG] 1.1.5b2 & tiff g3 Message-ID: <633000118.20050103153440@eworld.hu> Hello! Does anybody have G3 TIFF decode (and/or encode?) patch for PIL 1.1.5b2? I have seen a patch for 1.1.4 but it looks to be not compatible with 1.1.5b2. I use 1.1.4 to generate tiff images in multithreaded python script. As I read in changelog, 1.1.5 should work better while it releases GIL. How much could it improve? When is 1.1.5 planned to be released? Thanks in advance, Tamas J. From golux at comcast.net Fri Jan 7 00:34:19 2005 From: golux at comcast.net (Stephen Waterbury) Date: Fri Jan 7 00:34:33 2005 Subject: [Image-SIG] A tweak I needed when building PIL on FC1 Message-ID: <41DDCAFB.7050303@comcast.net> When I was building PIL on my Fedora Core 1 machine, I got the following error: --------------------------------------- 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 --------------------------------------- ... so I added the line: --------------------------------------- #include --------------------------------------- to _imagingft.c (just before '#include '), and then it built and installed okay. I don't know whether the error was caused by something stupid I did, but just thought I'd share that in case it wasn't. Cheers, Steve From burlen at apollo.sr.unh.edu Fri Jan 7 20:59:43 2005 From: burlen at apollo.sr.unh.edu (Burlen) Date: Fri Jan 7 20:59:46 2005 Subject: [Image-SIG] error during PIL on x86_64 Message-ID: <200501071459.43449.burlen@apollo.sr.unh.edu> In case anyone else is trying to install the PIL on x86_64 and gets the same problems: I am running fedora c2, first I had to edit the Makefile in libImaging to inculde -fPIC compiler flag then, during python setup.py build: root@quaoar:/usr/local/Imaging-1.1.4$ python setup.py build running build running build_py running build_ext building '_imaging' extension gcc -pthread -shared build/temp.linux-x86_64-2.3/_imaging.o build/temp.linux-x86_64-2.3/decode.o build/temp.linux-x86_64-2.3/encode.o build/temp.linux-x86_64-2.3/map.o build/temp.linux-x86_64-2.3/display.o build/temp.linux-x86_64-2.3/outline.o build/temp.linux-x86_64-2.3/path.o -LlibImaging -lImaging -ljpeg -lz -o build/lib.linux-x86_64-2.3/_imaging.so building '_imagingtk' extension creating build/temp.linux-x86_64-2.3/Tk gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -IlibImaging -I/usr/local/include/python2.3 -c _imagingtk.c -o build/temp.linux-x86_64-2.3/_imagingtk.o 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-x86_64-2.3/Tk/tkImaging.o Tk/tkImaging.c: In function `TkImaging_Init': Tk/tkImaging.c:198: warning: passing arg 3 of `Tcl_CreateCommand' from incompatible pointer type gcc -pthread -shared build/temp.linux-x86_64-2.3/_imagingtk.o build/temp.linux-x86_64-2.3/Tk/tkImaging.o -LlibImaging -lImaging -ltk8.4 -ltcl8.4 -o build/lib.linux-x86_64-2.3/_imagingtk.so building '_imagingft' extension gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -IlibImaging -I/usr/include/freetype2 -I/usr/local/include/python2.3 -c _imagingft.c -o build/temp.linux-x86_64-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 fixed by adding: #include " #include FT_FREETYPE_H into _imagingft.c before other include directives From jwt at OnJapan.net Sat Jan 8 02:31:34 2005 From: jwt at OnJapan.net (Jim Tittsler) Date: Sat Jan 8 02:30:35 2005 Subject: [Image-SIG] error during PIL on x86_64 In-Reply-To: <200501071459.43449.burlen@apollo.sr.unh.edu> References: <200501071459.43449.burlen@apollo.sr.unh.edu> Message-ID: <20050108013134.GM3271@server.onjapan.net> On Fri, Jan 07, 2005 at 02:59:43PM -0500, Burlen wrote: > In case anyone else is trying to install the PIL on x86_64 and > gets the same problems: > > #include " > #include FT_FREETYPE_H I think you are the second person to report that this week. It is in the errata for 1.1.4: If I were you, I'd just skip straight to the beta versions of 1.1.5. It has a new setup.py that streamlines the build process. -- Jim Tittsler http://www.OnJapan.net/ GPG: 0x01159DB6 Python Starship http://Starship.Python.net/ Ringo MUG Tokyo http://www.ringo.net/rss.html From ostolski at kwantum.gda.pl Mon Jan 10 08:25:47 2005 From: ostolski at kwantum.gda.pl (Darek Ostolski) Date: Mon Jan 10 08:17:03 2005 Subject: [Image-SIG] Python Imaging Library 1.1.4 Source Kit Linux patch. Message-ID: <41E22DFB.7000605@kwantum.gda.pl> Hello!!! There is an bug in this package, it can be done by trying to open word document under linux. This was probably a type, I send you patch. I'm sorry but my english isn't very well Best Darek Ostolski -------------- next part -------------- 298c298 < if ix == 0xFFFFFFFEL or x == 0xFFFFFFFFL: --- > if ix == 0xFFFFFFFEL or ix == 0xFFFFFFFFL: From jwt at OnJapan.net Mon Jan 10 14:16:53 2005 From: jwt at OnJapan.net (Jim Tittsler) Date: Mon Jan 10 14:16:00 2005 Subject: [Image-SIG] Python Imaging Library 1.1.4 Source Kit Linux patch. In-Reply-To: <41E22DFB.7000605@kwantum.gda.pl> References: <41E22DFB.7000605@kwantum.gda.pl> Message-ID: <20050110131653.GB24754@server.onjapan.net> On Mon, Jan 10, 2005 at 08:25:47AM +0100, Darek Ostolski wrote: > There is an bug in this package, it can be done by trying to open word > document under linux. [...] > 298c298 > < if ix == 0xFFFFFFFEL or x == 0xFFFFFFFFL: > --- > > if ix == 0xFFFFFFFEL or ix == 0xFFFFFFFFL: This is one of the known problems that is listed on the 1.1.4 errata page. -- Jim Tittsler http://www.OnJapan.net/ GPG: 0x01159DB6 Python Starship http://Starship.Python.net/ Ringo MUG Tokyo http://www.ringo.net/rss.html From kevin at cazabon.com Mon Jan 10 23:35:26 2005 From: kevin at cazabon.com (kevin@cazabon.com) Date: Mon Jan 10 23:35:23 2005 Subject: [Image-SIG] Problems with TIFFs from Corel Draw? Message-ID: <03da01c4f764$ae6dacb0$640aa8c0@duallie> Has anyone had problems opening TIFF images from Corel Draw (version 10 at least, if not others) using PIL? A user of one of my programs is having issues, and the test image results in the following error when you try to Image.open(file): IOError: cannot identify image file The magic number looks ok, Photoshop opens it ok, but PIL doesn't like it. I've posted a copy of the sample file that has problems at: http://www.cazabon.com/images/testCorel.tif Any suggestions would be welcome, otherwise I'll have to dig into the TIFF image plugin... I'd rather not go there if it's a problem anyone else has seen before. Thanks Kevin. From santillo at mpsgr.it Tue Jan 11 11:08:03 2005 From: santillo at mpsgr.it (Santillo Piergiorgio) Date: Tue Jan 11 11:07:18 2005 Subject: [Image-SIG] Import _imaging problems Message-ID: <49C24D81C7227A4E85CCB673974FB42129FE81@MAILSERVER-B.mpsgr.it> I made all the things descripted in the FAQ page. I've installed Python 2.3.4 on a WINDOWS 2000 system. >>> import _imaging Traceback (most recent call last): File "", line 1, in ? ImportError: DLL load failed: The specified module could not be found. This is the result of the test: >>> import Image # C:\Python23\lib\site-packages\PIL\Image.pyc matches C:\Python23\lib\site-packa ges\PIL\Image.py import Image # precompiled from C:\Python23\lib\site-packages\PIL\Image.pyc # C:\Python23\lib\lib-tk\FixTk.pyc matches C:\Python23\lib\lib-tk\FixTk.py import FixTk # precompiled from C:\Python23\lib\lib-tk\FixTk.pyc import _tkinter # dynamically loaded from C:\Python23\DLLs\_tkinter.pyd # C:\Python23\lib\string.pyc matches C:\Python23\lib\string.py import string # precompiled from C:\Python23\lib\string.pyc import strop # builtin # C:\Python23\lib\site-packages\PIL\ImagePalette.pyc matches C:\Python23\lib\sit e-packages\PIL\ImagePalette.py import ImagePalette # precompiled from C:\Python23\lib\site-packages\PIL\ImagePa lette.pyc import array # builtin import operator # builtin >>> As you can see, the import Image command doesn't import the _imaging module!! This is sys.path variable >>> import sys >>> print sys.path ['', 'C:\\WINNT\\system32\\python23.zip', 'U:\\', 'C:\\Python23\\DLLs', 'C:\\Pyt hon23\\lib', 'C:\\Python23\\lib\\plat-win', 'C:\\Python23\\lib\\lib-tk', 'C:\\Py thon23', 'C:\\Python23\\lib\\site-packages', 'C:\\Python23\\lib\\site-packages\\ PIL'] >>> PIL is installed correctly installed under C:\Python23\lib\site-packages\PIL. Any suggestions?? Piergiorgio Santillo Monte Paschi Asset Management SGR S.p.A. Via San Vittore, 37 - 20123 Milano, Italia Tel.: +39 02 43828 518 "Le informazioni trasmesse sono da intendersi per esclusivo uso del destinatario e possono contenere informazioni e materiale confidenziale e privilegiato. Qualsiasi correzione, inoltro o divulgazione in qualsiasi forma e modo anche a tenore generale ? del tutto proibita. Se avete ricevuto per errore il presente messaggio, cortesemente contattate subito il mittente e cancellate da qualsiasi supporto il messaggio e gli allegati a voi giunti. Tutti gli usi illegali saranno perseguiti penalmente e civilmente da Monte Paschi Asset Management SGR S.p.A." "The informations transmitted are intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination, taking of any action in reliance upon, or other general use are strictly prohibited. If you received this in error, please contact immediately the sender and delete the material from any computer. All the Illegal use will be persecuted by Monte Paschi Asset Management SGR S.p.A." From rowen at cesmail.net Wed Jan 12 19:53:21 2005 From: rowen at cesmail.net (Russell E. Owen) Date: Wed Jan 12 19:53:41 2005 Subject: [Image-SIG] Installation help wanted Message-ID: I'm running into trouble with a linux install of PIL. My setup: - libjpeg and libz are in /usr/lib - the python and tcl/tk I want to use are on /net/python, a network-shared volume. Python 2.3.4 is /net/python/bin/python and was built with tcl/tk 8.4.6 which are in /net/python/lib, /net/python/include etc. I modify my environment as follows: setenv PATH "/net/python/bin/:"$PATH setenv LD_LIBRARY_PATH "/net/python/lib" setenv TCLLIBPATH "/net/tcllib" I tried the simple installation first. Building libImaging with ./configure and make seemed to go fine. ./configure finds libjpeg and libz and there were no warnings or errors. However, the setup.py build step fails...: $ /net/python/bin/python setup.py build ... build/temp.linux-i686-2.3/Tk/tkImaging.o -LlibImaging -lImaging -ltk8.4 -ltcl8.4 -o build/lib.linux-i686-2.3/_imagingtk.so /usr/bin/ld: cannot find -ltk8.4 collect2: ld returned 1 exit status error: command 'gcc' failed with exit status 1 So I tried copying Setup.in to Setup and editing it. I made the location of libjpeg, libz and tcl/tk explicit and didn't mess with anything else: -I/usr/include -L/usr/lib -ljpeg \ ... -I/usr/include -L/usr/lib -lz ... _imagingtk _imagingtk.c \ -IlibImaging Tk/tkImaging.c \ -I/astro/net/python/include -L/astro/net/python/lib -ltcl8.3 -ltk8.3 \ -L/usr/X11R6/lib -lX11 I then did what I thought the instructions said to do: $ cd libImaging $ ./configure $ make $ cd .. # examine Makefile.pre.in; nothing obvious to fix (?) $ make -f Makefile.pre.in boot $ make gcc -pthread -fPIC -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -I/net/python/include/python2.3 -I/net/python/include/python2.3 @DEFS@ -IlibImaging -I/usr/include -I/usr/include -c ././_imaging.c -o ./_imaging.o gcc: cannot specify -o with -c or -S and multiple compilations make: *** [_imaging.o] Error 1 Any hints on what to try next? -- Russell From bill at big-springs.com Wed Jan 12 20:28:37 2005 From: bill at big-springs.com (Bill Tolbert) Date: Wed Jan 12 20:30:27 2005 Subject: [Image-SIG] extracting pattern coordinates Message-ID: Is it possible to 'search' an image for a pattern? I want to locate text entry boxes in a black and white bitmap and extract the coordinates. The text boxes would simply be rectangles. The ultimate goal is to automatically create an html form that has text boxes located and sized based on the image. The image becomes a background image for the form. Thanks! Bill From rowen at cesmail.net Wed Jan 12 20:59:13 2005 From: rowen at cesmail.net (Russell E. Owen) Date: Wed Jan 12 20:59:21 2005 Subject: [Image-SIG] Re: Installation help wanted References: Message-ID: In article , "Russell E. Owen" wrote: > I'm running into trouble with a linux install of PIL. > > My setup: > - libjpeg and libz are in /usr/lib > - the python and tcl/tk I want to use are on /net/python, a > network-shared volume. Python 2.3.4 is /net/python/bin/python and was > built with tcl/tk 8.4.6 which are in /net/python/lib, > /net/python/include etc. > > I modify my environment as follows: > setenv PATH "/net/python/bin/:"$PATH > setenv LD_LIBRARY_PATH "/net/python/lib" > setenv TCLLIBPATH "/net/tcllib" ...found a simple solution, after reading an entry in the README for a different platform and modifying it for my situation (including making it tcsh compatible). Defining these additional variables made the simple default build work correctly: setenv LDFLAGS "-L/net/python/lib" setenv CPPFLAGS "-I/net/python/lib" -- Russell From rowen at cesmail.net Wed Jan 12 21:08:29 2005 From: rowen at cesmail.net (Russell E. Owen) Date: Wed Jan 12 21:08:37 2005 Subject: [Image-SIG] zoom for TkImage? Message-ID: PIL's ImageTk.PhotoImage object can be used in place of a Tkinter PhototImage, but does not have Tkinter's zoom and subsample methods. I realize PIL has other tools for resizing images (and they are more flexible and can do zoom in and out with one method instead of two), but nonetheless these methods would be useful additions, not just for compatibility, but also in reducing the # of copies of PIL objects that need to be kept around (no need for a zoomed PIL Image and a zoomed PIL PhotoImage). So this is a request to add zoom and subsample methods to PIL's PhotoImage class. Regards, -- Russell From feix at rutchem.rutgers.edu Wed Jan 12 21:12:55 2005 From: feix at rutchem.rutgers.edu (Fei Xu) Date: Wed Jan 12 21:14:12 2005 Subject: [Image-SIG] install PIL Message-ID: <49520.172.23.32.14.1105560775.squirrel@hvc.rutgers.edu> Hi! I am installing PIL on Mac Os X. I ran the command python setup.py build and get an error messange as below: Fatal Python error: Interpreter not initialized (version mismatch?) Abort How can I fix this problem? thanks a lot! fei From jb2410 at columbia.edu Wed Jan 12 21:23:44 2005 From: jb2410 at columbia.edu (Jonah Bossewitch) Date: Wed Jan 12 21:23:49 2005 Subject: [Image-SIG] human readable IPTC field names? Message-ID: Hi, ps - I apologize for x-posting this message, but image-sig looked like it has been inactive since 2001. I am using the IptcImagePlugin to extract the IPTC tags from an image file. I was able to successfully retrieve the tags from the image (thanks!), but the results are keyed off of cryptic tuples. I found the lookup codes here - http://demo.imagefolio.com/demo/ImageFolio31_files/skins/cool_blue/ images/iptc.html, but I was wondering if these existed anywhere in the code. Would it make sense to include a label lookup on these keys? Maybe as a dictionary or a properties file alongside the IptcImagePlugin? I am not sure if these field names are standard, but named lookups off of keys would be much more readable does such a lookup table exist? Does it make sense to include with the IptcImagePlugin? I would be willing to work on this if anyone was interested. thanks, Jonah ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Jonah Bossewitch Technology and Programmer Analyst ccnmtl.columbia.edu jb2410 at columbia dot edu 212.854.1815 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From Chris.Barker at noaa.gov Thu Jan 13 00:41:04 2005 From: Chris.Barker at noaa.gov (Chris Barker) Date: Thu Jan 13 00:45:52 2005 Subject: [Image-SIG] install PIL In-Reply-To: <49520.172.23.32.14.1105560775.squirrel@hvc.rutgers.edu> References: <49520.172.23.32.14.1105560775.squirrel@hvc.rutgers.edu> Message-ID: <41E5B590.9070504@noaa.gov> Fei Xu wrote: > I am installing PIL on Mac Os X. I ran the command python setup.py build > and get an error messange as below: > Fatal Python error: Interpreter not initialized (version mismatch?) > Abort That looks like the error you get when you have more than one version of Python installed on your system, and OS-X mixes the libraries up. This happens because of the way the python that came with OS-X (2.3.0) was put together. The easiest solution is to get rid of all pythons except Apple's one. Unless you REALLY need something in a more recent version, it works just fine. Also, you should be able to get PIL through the Package Manager that comes with the MacPython add-ons package. If you have other problems, search the Python-Mac mailing list, or post a question there if your question isn't answered in the archives. -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker@noaa.gov From bob at redivi.com Thu Jan 13 00:53:51 2005 From: bob at redivi.com (Bob Ippolito) Date: Thu Jan 13 00:53:56 2005 Subject: [Image-SIG] install PIL In-Reply-To: <41E5B590.9070504@noaa.gov> References: <49520.172.23.32.14.1105560775.squirrel@hvc.rutgers.edu> <41E5B590.9070504@noaa.gov> Message-ID: <359132EA-64F5-11D9-B569-000A95BA5446@redivi.com> On Jan 12, 2005, at 18:41, Chris Barker wrote: > > Fei Xu wrote: >> I am installing PIL on Mac Os X. I ran the command python setup.py >> build >> and get an error messange as below: >> Fatal Python error: Interpreter not initialized (version mismatch?) >> Abort > > That looks like the error you get when you have more than one version > of Python installed on your system, and OS-X mixes the libraries up. > This happens because of the way the python that came with OS-X (2.3.0) > was put together. > > The easiest solution is to get rid of all pythons except Apple's one. > Unless you REALLY need something in a more recent version, it works > just fine. After you remove other Python installations, remove any extension you built while you had multiple Python installations. These extensions are linked incorrectly. > Also, you should be able to get PIL through the Package Manager that > comes with the MacPython add-ons package. Available from , but a new version is these add-ons is coming out Very Soon that incorporates fixes to PackageManager, etc. > If you have other problems, search the Python-Mac mailing list, or > post a question there if your question isn't answered in the archives. Once you have removed other Python(s), install this fix (referenced by ). After this fix is installed, it will be safe (well, safer) to have multiple Python installations. -bob From morten at nidelven-it.no Thu Jan 13 05:57:24 2005 From: morten at nidelven-it.no (Morten W. Petersen) Date: Thu Jan 13 05:57:30 2005 Subject: [Image-SIG] Creating text on images Message-ID: <41E5FFB4.7070403@nidelven-it.no> Hi all, I'm trying to create a script that will superimpose text on an image. I didn't find any great examples out there on how this can be done (I presume using PIL is necessary), do you know of any examples? Thanks, Morten From lists at hlabs.spb.ru Thu Jan 13 09:00:43 2005 From: lists at hlabs.spb.ru (Dmitry Vasiliev) Date: Thu Jan 13 08:59:36 2005 Subject: [Image-SIG] Creating text on images In-Reply-To: <41E5FFB4.7070403@nidelven-it.no> References: <41E5FFB4.7070403@nidelven-it.no> Message-ID: <41E62AAB.8030502@hlabs.spb.ru> Morten W. Petersen wrote: > Hi all, > > I'm trying to create a script that will superimpose text on an image. I > didn't find any great examples out there on how this can be done (I > presume using PIL is necessary), do you know of any examples? You can do it like this: >>> from PIL import Image, ImageDraw >>> image = Image.new("L", (100, 50)) >>> draw = ImageDraw.Draw(image) >>> draw.text((10, 10), "Hello, World!", fill=0xff) >>> image.show() See also ImageFont module. -- Dmitry Vasiliev (dima at hlabs.spb.ru) http://hlabs.spb.ru From morten at nidelven-it.no Thu Jan 13 09:56:13 2005 From: morten at nidelven-it.no (Morten W. Petersen) Date: Thu Jan 13 09:56:24 2005 Subject: [Image-SIG] Creating text on images In-Reply-To: <41E62AAB.8030502@hlabs.spb.ru> References: <41E5FFB4.7070403@nidelven-it.no> <41E62AAB.8030502@hlabs.spb.ru> Message-ID: <41E637AD.1000601@nidelven-it.no> Just what I needed, thanks! :) -Morten Dmitry Vasiliev skrev: > Morten W. Petersen wrote: > >> Hi all, >> >> I'm trying to create a script that will superimpose text on an image. >> I didn't find any great examples out there on how this can be done (I >> presume using PIL is necessary), do you know of any examples? > > > You can do it like this: > > >>> from PIL import Image, ImageDraw > >>> image = Image.new("L", (100, 50)) > >>> draw = ImageDraw.Draw(image) > >>> draw.text((10, 10), "Hello, World!", fill=0xff) > >>> image.show() > > See also ImageFont module. > From extra300aikvdfgtfx at worldnet.att.com Fri Jan 14 08:54:59 2005 From: extra300aikvdfgtfx at worldnet.att.com ( Hasika Zosia ) Date: Fri Jan 14 13:05:44 2005 Subject: [Image-SIG] Re: your website Message-ID: <7fad01c4fa1f$1c339810$f5f4450b@extra300aikvdfgtfx> Go, www.ezlink101.com No, www.ezlink101.com LI0901545914 From William.T.Bridgman.1 at gsfc.nasa.gov Fri Jan 14 15:57:59 2005 From: William.T.Bridgman.1 at gsfc.nasa.gov (W.T. Bridgman) Date: Fri Jan 14 15:56:39 2005 Subject: [Image-SIG] More support for McIDAS format Message-ID: I've modified the McIdasImagePlugin.py to give a little more support for DIR & NAV (Mercator projection) data blocks. How do I go about getting this into the next PIL release? Tom -- 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: 301-286-1634 http://svs.gsfc.nasa.gov/ From wesley.fraser at nrc.ca Fri Jan 14 20:56:13 2005 From: wesley.fraser at nrc.ca (Wes Fraser) Date: Fri Jan 14 20:56:17 2005 Subject: [Image-SIG] Crash during make step of installing image library. HELP!! Message-ID: <585E81DE-6666-11D9-ACD2-000A95E96858@nrc.ca> I am having some issues installing PIL with jpeg support onto my machine. I am running mac os x 10.3 with python 2.3. I have the factory install of python and have tried it with custom installs of 2.3.4 with no success. I have installed libjpeg from source and have tried it with the fink install and have not been able to make either work. IFollowing the instructions on http://plone.org/documentation-old/howto/InstallPILOnMacOSX and after installing libjpeg with fink In Imaging-1.1.3/libImaging do a $LDFLAGS="-L/sw/lib"; CPPFLAGS="-l/sw/lib"; ./configure then do a $ make at this point I get the warning: ranlib: file: libImaging.a(Dib.o) has no symbols The web page says to ignore this and continue. So I then do cd .. python setup.py build and it crashes with the following error: Tk/tkImaging.c:198: warning: passing arg 3 of `Tcl_CreateCommand' from incompatible pointer type gcc -Wl,-F. -bundle -framework Python build/temp.darwin-7.7.0-Power_Macintosh-2.3/_imagingtk.o build/temp.darwin-7.7.0-Power_Macintosh-2.3/Tk/tkImaging.o -LlibImaging -lImaging -o build/lib.darwin-7.7.0-Power_Macintosh-2.3/_imagingtk.so ld: Undefined symbols: _Tcl_AppendResult _Tcl_CreateCommand _Tk_FindPhoto _Tk_PhotoBlank _Tk_PhotoPutBlock_NoComposite error: command 'gcc' failed with exit status 1 Can you guys help me out at all? I have no idea why this went wrong but it is sure driving me nutz. Thanks Wes From bob at redivi.com Fri Jan 14 21:23:33 2005 From: bob at redivi.com (Bob Ippolito) Date: Fri Jan 14 21:23:39 2005 Subject: [Image-SIG] Crash during make step of installing image library. HELP!! In-Reply-To: <585E81DE-6666-11D9-ACD2-000A95E96858@nrc.ca> References: <585E81DE-6666-11D9-ACD2-000A95E96858@nrc.ca> Message-ID: <29E386D0-666A-11D9-A02F-000A95BA5446@redivi.com> On Jan 14, 2005, at 14:56, Wes Fraser wrote: > I am having some issues installing PIL with jpeg support onto my > machine. I am running mac os x 10.3 with python 2.3. I have the > factory install of python and have tried it with custom installs of > 2.3.4 with no success. > > > > I have installed libjpeg from source and have tried it with the fink > install and have not been able to make either work. > > > > IFollowing the instructions on > > http://plone.org/documentation-old/howto/InstallPILOnMacOSX > > and after installing libjpeg with fink > > > > In Imaging-1.1.3/libImaging do a > > $LDFLAGS="-L/sw/lib"; CPPFLAGS="-l/sw/lib"; ./configure > > > > then do a > > $ make > > > > at this point I get the warning: > > ranlib: file: libImaging.a(Dib.o) has no symbols > > > > The web page says to ignore this and continue. > > > > So I then do > > cd .. > > python setup.py build > > > > and it crashes with the following error: > > > > Tk/tkImaging.c:198: warning: passing arg 3 of `Tcl_CreateCommand' > from incompatible pointer type > > gcc -Wl,-F. -bundle -framework Python > build/temp.darwin-7.7.0-Power_Macintosh-2.3/_imagingtk.o > build/temp.darwin-7.7.0-Power_Macintosh-2.3/Tk/tkImaging.o > -LlibImaging -lImaging -o > build/lib.darwin-7.7.0-Power_Macintosh-2.3/_imagingtk.so > > ld: Undefined symbols: > > _Tcl_AppendResult > > _Tcl_CreateCommand > > _Tk_FindPhoto > > _Tk_PhotoBlank > > _Tk_PhotoPutBlock_NoComposite > > error: command 'gcc' failed with exit status 1 > > > > Can you guys help me out at all? I have no idea why this went wrong > but it is sure driving me nutz. I have no idea why PIL is building against Tcl and Tk without linking to them, but I would suggest removing _imagingtk.so, the rest of PIL will build fine without it. I don't have PIL source handy, so I can't tell you precisely where to disable building of it. Probably in a file with "setup" in its name. -bob From martin at tele.ucl.ac.be Mon Jan 17 15:04:59 2005 From: martin at tele.ucl.ac.be (Olivier Martin) Date: Mon Jan 17 15:05:04 2005 Subject: [Image-SIG] PIL for Python 2.4 ? Message-ID: <6.0.0.22.2.20050117150228.01cc4eb0@pop.tele.ucl.ac.be> Hi, I have the latest version of Python installed (2.4). The latest PIL is version 1.1.4, for Python 2.3 ... As I tried to run PIL 1.1.4 on top of Python 2.4, PIL cannot find Python 2.3 .... Is there a way to use PIL on top of Python 2.4 ? THanks in advance, Olivier Martin, newcomer From steve at holdenweb.com Mon Jan 17 15:41:09 2005 From: steve at holdenweb.com (Steve Holden) Date: Mon Jan 17 15:45:56 2005 Subject: [Image-SIG] PIL for Python 2.4 ? In-Reply-To: <6.0.0.22.2.20050117150228.01cc4eb0@pop.tele.ucl.ac.be> References: <6.0.0.22.2.20050117150228.01cc4eb0@pop.tele.ucl.ac.be> Message-ID: <41EBCE85.8090606@holdenweb.com> Olivier Martin wrote: > Hi, > > I have the latest version of Python installed (2.4). The latest PIL is > version 1.1.4, for Python 2.3 ... As I tried to run PIL 1.1.4 on top of > Python 2.4, PIL cannot find Python 2.3 .... > > Is there a way to use PIL on top of Python 2.4 ? > > THanks in advance, > > Olivier Martin, newcomer > Well, you could upgrade to PIL 1.1.5b1, for example, available from http://effbot.org/downloads/#PIL I believe the quality and backward compatibility is excellent, despite the release's beta status. Or, if you can compile extensions yourself, you could download the 1.1.4 source from http://www.pythonware.com/products/pil/ and do that. regards Steve -- Steve Holden http://www.holdenweb.com/ Python Web Programming http://pydish.holdenweb.com/ Holden Web LLC +1 703 861 4237 +1 800 494 3119 From fredrik at pythonware.com Mon Jan 17 21:57:18 2005 From: fredrik at pythonware.com (Fredrik Lundh) Date: Mon Jan 17 21:57:14 2005 Subject: [Image-SIG] Re: Problems with TIFFs from Corel Draw? References: <03da01c4f764$ae6dacb0$640aa8c0@duallie> Message-ID: kevin@cazabon.com wrote: > Has anyone had problems opening TIFF images from Corel Draw (version 10 at > least, if not others) using PIL? A user of one of my programs is having > issues, and the test image results in the following error when you try to > Image.open(file): > > IOError: cannot identify image file > > The magic number looks ok, Photoshop opens it ok, but PIL doesn't like it. > > I've posted a copy of the sample file that has problems at: > http://www.cazabon.com/images/testCorel.tif the file is said to have 999 extra layers, which is a bit more than PIL can handle... running with Image.DEBUG = 1 results in this output: tag: NewSubfileType (254) - type: long (4) - value: (0,) tag: ImageWidth (256) - type: long (4) - value: (100,) tag: ImageLength (257) - type: long (4) - value: (100,) tag: BitsPerSample (258) - type: short (3) - value: (8, 8, 8, 8) tag: Compression (259) - type: short (3) - value: (1,) tag: PhotometricInterpretation (262) - type: short (3) - value: (2,) tag: ImageDescription (270) - type: ascii (2) - value: tag: StripOffsets (273) - type: long (4) - value: (32, 8032, 16032, 24032, 32032) tag: Orientation (274) - type: short (3) - value: (1,) tag: SamplesPerPixel (277) - type: short (3) - value: (4,) tag: RowsPerStrip (278) - type: long (4) - value: (20,) tag: StripByteCounts (279) - type: long (4) - value: (8000, 8000, 8000, 8000, 8000) tag: XResolution (282) - type: rational (5) - value: ((10629921, 100000),) tag: YResolution (283) - type: rational (5) - value: ((10629921, 100000),) tag: ResolutionUnit (296) - type: short (3) - value: (3,) tag: ExtraSamples (338) - type: short (3) - value: (999,) tag: unknown (34016) - type: ascii (2) - value: tag: unknown (34017) - type: ascii (2) - value: tag: unknown (34018) - type: ascii (2) - value: tag: unknown (34019) - type: short (3) - value: (0,) tag: unknown (34020) - type: short (3) - value: (8,) tag: unknown (34021) - type: short (3) - value: (16,) tag: unknown (34022) - type: byte (1) - value: () tag: unknown (34023) - type: byte (1) - value: (0,) tag: unknown (34024) - type: byte (1) - value: (0,) tag: unknown (34025) - type: byte (1) - value: () tag: unknown (34026) - type: byte (1) - value: () tag: unknown (34027) - type: byte (1) - value: (0, 0) tag: unknown (34028) - type: byte (1) - value: (0,) tag: unknown (34029) - type: ascii (2) - value: tag: unknown (34030) - type: long (4) - value: (0,) *** Summary *** - compression: raw - photometric_interpretation: 2 - planar_configuration: 1 - fill_order: 1 - size: (100, 100) format key: (2, 1, 1, (8, 8, 8, 8), (999,)) - unsupported format I'll look at this when I find the time (but don't let that stop you from digging into the code). From fredrik at pythonware.com Mon Jan 17 22:12:54 2005 From: fredrik at pythonware.com (Fredrik Lundh) Date: Mon Jan 17 22:12:58 2005 Subject: [Image-SIG] Re: Problems with TIFFs from Corel Draw? References: <03da01c4f764$ae6dacb0$640aa8c0@duallie> Message-ID: I wrote: >> The magic number looks ok, Photoshop opens it ok, but PIL doesn't like it. >> >> I've posted a copy of the sample file that has problems at: >> http://www.cazabon.com/images/testCorel.tif > > the file is said to have 999 extra layers, which is a bit more than PIL > can handle... my mistake: (999,) means the extra layer has the type code 999, which doesn't seem to be defined in the TIFF specification. google brings up: http://www.asmail.be/msg0054846667.html "Obviously an error. Extra samples should be 1 if photometric=RGB and bps has 4 entries." and http://bugzilla.remotesensing.org/show_bug.cgi?id=73 which includes a fix for libtiff, which could probably be adapted for PIL From jbreiden at parc.com Tue Jan 18 01:43:14 2005 From: jbreiden at parc.com (Jeff Breidenbach) Date: Tue Jan 18 01:43:32 2005 Subject: [Image-SIG] additional parameter for rotate API Message-ID: <1106008994.29623.14.camel@rode.parc.com> Hi all, I've appended the API for the PIL rotate function below. When one rotates a rectangular image, there are always "gaps" that need to be filled in. You know, the triangular areas that were not part of the image before rotation. For an RGB image, PIL currently fills in these gaps with black. I'd like to see the fill color be programmable (or at least have the ability to set it to white). What do people think? This would require an extension to the API. Cheers, Jeff ========== rotate im.rotate(angle) => image im.rotate(angle, filter) => image Returns a copy of an image rotated the given number of degrees counter clockwise around its centre. The filter argument can be one of NEAREST (use nearest neighbour), BILINEAR (linear interpolation in a 2x2 environment), or BICUBIC (cubic spline interpolation in a 4x4 environment). If omitted, or if the image has mode "1" or "P", it is set to NEAREST. -- Jeff Breidenbach Palo Alto Research Center (PARC) From contract3.planning at anglesey.gov.uk Tue Jan 18 13:29:26 2005 From: contract3.planning at anglesey.gov.uk (CGIP CGIP) Date: Tue Jan 18 13:22:03 2005 Subject: [Image-SIG] PIL:decoder group4 not available error Message-ID: hi I'm getting a "decoder group4 not available" error against some back & white .tif images, when using PIL to process a mixed bag of scanned documents in a large archive. Anyone come across or written a PIL decoder for this format (otherwise I'll have to batch convert them with photoshop or something)... cheers RA Anglesey UK From guillaume.proux at scala.com Tue Jan 25 03:57:06 2005 From: guillaume.proux at scala.com (Guillaume Proux) Date: Tue Jan 25 03:56:43 2005 Subject: [Image-SIG] PIL License Message-ID: <41F5B582.5020600@scala.com> Dear PIL maintainer/users, My company is toying with the idea (a bit pushed by me of course) to build a custom distribution of Python to pair with our software. So far so good, I have an installer for Windows that installs Python 2.3.4, cjkcodecs, pywin32, PIL, ctypes, pyserial/pyparallel,numarray, py2exe,pygtk,pysqlite etc... Now I am reviewing the License of every package and PIL licenses seems to me to NOT allow redistribution of PIL modules with a product that costs money. Excerpt from the LIcense file: << Permission to [...] for any purpose *** and without fee *** is hereby granted >> Does that mean that PIL must be left out? Or is this an oversight? I am looking forward to your comments. Best regards, Guillaume From guillaume.proux at scala.com Tue Jan 25 04:30:45 2005 From: guillaume.proux at scala.com (Guillaume Proux) Date: Tue Jan 25 04:30:21 2005 Subject: [Image-SIG] PIL License In-Reply-To: <41F5B582.5020600@scala.com> References: <41F5B582.5020600@scala.com> Message-ID: <41F5BD65.2030001@scala.com> Me again, It seems that my English parser is not up to the task. I saw the same sentence written in another license (pysqlite). So I now assume that the "without fee" applies to the "Permission is granted without fee". Other licenses use simpler and clearer expressions. Sorry for the confusion. Regards, Guillaume From fredrik at pythonware.com Wed Jan 26 14:02:18 2005 From: fredrik at pythonware.com (Fredrik Lundh) Date: Wed Jan 26 14:02:33 2005 Subject: [Image-SIG] Re: PIL License References: <41F5B582.5020600@scala.com> <41F5BD65.2030001@scala.com> Message-ID: Guillaume Proux wrote: > It seems that my English parser is not up to the task. I saw the same sentence written in another > license (pysqlite). > So I now assume that the "without fee" applies to the "Permission is granted without fee". I'd say that's a reasonable assumption: Permission to /.../ for any purpose and without fee is hereby granted > Other licenses use simpler and clearer expressions. I'm still using the original Python (pre-1.6) license, which is also used by many other Python extensions. in OSI terms, this is known as the "Historical Permission Notice and Disclaimer": http://www.opensource.org/licenses/historical.php (yes, this really is ancient software ;-) From pascor at hotpop.com Thu Jan 27 00:08:56 2005 From: pascor at hotpop.com (Ray Pasco) Date: Thu Jan 27 00:09:59 2005 Subject: [Image-SIG] Where is the indexed PNG alpha table ? Message-ID: <41F82308.9030507@hotpop.com> I am wondering how to get at the alpha layer table that goes along with an indexed PNG image. Thanks From douglas at paradise.net.nz Thu Jan 27 01:58:18 2005 From: douglas at paradise.net.nz (Douglas Bagnall) Date: Thu Jan 27 01:58:18 2005 Subject: [Image-SIG] Where is the indexed PNG alpha table ? In-Reply-To: <41F82308.9030507@hotpop.com> References: <41F82308.9030507@hotpop.com> Message-ID: <41F83CAA.20105@paradise.net.nz> Ray Pasco wrote: > I am wondering how to get at the alpha layer table that goes along > with an indexed PNG image. > I believe that alpha in an indexed PNG is not stored as a channel, but as indexed colours. In other words, the index is not of RGB values, but of RGBA values. If you only have full transparancy, there'll only be one index value for it, and PIL will probably do the right thing with >>> im = Image.open('indexed.png').convert('RGBA') but I'm not sure how it would cope with multiple semi-transparent values -- I don't know how to make such an image to test with. douglas From lroubeyrie at limair.asso.fr Thu Jan 27 12:08:58 2005 From: lroubeyrie at limair.asso.fr (Lionel Roubeyrie) Date: Thu Jan 27 12:10:10 2005 Subject: [Image-SIG] Broken Pipe Message-ID: <200501271208.58142.lroubeyrie@limair.asso.fr> Hi all, New in the PIL land, I want to use it to transform a PostScript file into an image file (png or gif), then I use this function: ################################# def convert(infile, outfile): import Image fp = Image.open(infile) fp.save(outfile) return outfile ################################# then convert('tutu.eps', 'tutu.jpg') works great. But if I call the same function using mod_python with Apache2, I get: ################################# File "/home/lionel/cartair.py", line 502, in convert fp.save(outfile) File "/usr/lib/python2.3/site-packages/PIL/Image.py", line 1125, in save self.load() File "/usr/lib/python2.3/site-packages/PIL/EpsImagePlugin.py", line 282, in load self.im = Ghostscript(self.tile, self.size, self.fp) File "/usr/lib/python2.3/site-packages/PIL/EpsImagePlugin.py", line 73, in Ghostscript gs.write(s) IOError: [Errno 32] Broken pipe ################################# Do I have to change something? Thanks PS : I use Debian Sarge with Python2.3.4 and PIL1.1.4 -- Lionel Roubeyrie - lroubeyrie@limair.asso.fr LIMAIR http://www.limair.asso.fr From mike at dmawebapps.com Thu Jan 27 15:35:32 2005 From: mike at dmawebapps.com (Michael De Paola) Date: Thu Jan 27 15:35:37 2005 Subject: [Image-SIG] Python Script Cannot Find PIL Message-ID: <6a4fe97ab7a34075ca33b42015c99d4b@dmawebapps.com> I have a Windows 2003 Server upon which I am trying to use Python and PIL to resize images with a cgi script. Invoking the script by CGI generates a 500 error. Running the script from a Windows command line raises the ImportError exception. Curiously enough however, from a Python prompt, calling "from PIL import Image" executes successfully. On the Windows system we have set the environment variable PYTHONPATH to be: d:\Program Files\Python234;d:\Program Files\Python234\Lib\site-packages\PIL;d:\Program Files\Python234\PIL; This looks okay to me. Does anyone have any suggestions on what we might be missing? Thanks, Mike From chris.stromberger at gmail.com Thu Jan 27 15:57:09 2005 From: chris.stromberger at gmail.com (Chris Stromberger) Date: Thu Jan 27 15:57:12 2005 Subject: [Image-SIG] PIL issue with desktop wallpaper changing--bug? In-Reply-To: References: Message-ID: Hello, It was suggested I send this thread to this list (originally posted to the python-win32 list). Details below. I traced the problem into a PIL module and found what appears to be the issue. Here's the fix I applied, and it does correct the problem I was seeing: >diff Image.py Image.py.fixed 1125c1125,1130 < self.load() --- > try: > self.load() > except: > if close: > fp.close() > raise The corrupt jpg raised an exception in the load function. Here's the relevant portion of the traceback: File "C:\Python23\lib\site-packages\PIL\Image.py", line 1126, in save self.load() File "C:\Python23\lib\site-packages\PIL\ImageFile.py", line 177, in load raise IOError("image file is truncated (%d bytes not processed)" % len(b)) IOError: image file is truncated (47 bytes not processed) I have PIL 1.1.4 installed (as far as I can tell), Windows XP. Thanks, Chris http://www.fetidcascade.com/ ---------- Forwarded message ---------- From: Chris Stromberger Date: Wed, 26 Jan 2005 17:41:10 -0600 Subject: Re: PIL issue with desktop wallpaper changing To: python-win32@python.org One more clue. If I change the code to resize always, then the corrupt jpg fails in the call to im.resize (before it attempts to call im.save), and thereafter there are no problems--the subsequent normal jpgs all work fine. So it appears that by failing in im.save, the 'windows.bmp' file is left with an open handle or somesuch to it somehow, in PIL, somewhere... On Wed, 26 Jan 2005 17:33:40 -0600, Chris Stromberger wrote: > I have a script to change the desktop wallpaper. If it encounters a > corrupt jpg, it seems to get off track and not recover. Here's the > code snippet. This is called in a loop with several jpg images in a > directory to switch the wallpaper. > > im = Image.open(filename) > [call im.resize() here if necessary to reduce/enlarge image size to fill screen] > im.save('wallpaper.bmp') > cs = ctypes.c_buffer('wallpaper.bmp') > ok = ctypes.windll.user32.SystemParametersInfoA(win32con.SPI_SETDESKWALLPAPER, > 0, cs, 0) > > The above fails in the im.save call when passed a corrupt jpg--an > exception is raised in im.save. I catch it and loop to the next > image. The next time this block is called, and for every call > thereafter, the SystemParametersInfoA call fails (returns 0), and if I > call GetLastError() after that, it shows error 32, which is a file > sharing violation. I added an os.unlink('wallpaper.bmp') to the start > of this block and it works until the corrupt jpg is processed. > Thereafter, the file cannot be deleted ([Errno 13] Permission denied). > So it seems like something is grabbing onto the file, but I have no > idea how to release that handle or what it is. > > One further clue: if I raise an exception (anything) after detecting > that ok is 0, then the next image I try to load will work. The > exception raising clears everything out. > > So here are the two scenarios: > > 0. call with normal image(s)--works, wallpaper is changed each time > 1. call with corrupt jpg--exception. > 2. then call with normal images--SystemParametersInfoA returns 0 every > time, wallpaper not changed again. > > if I add... > 3. raise exception if SystemParametersInfoA returns 0--the next and > subsequent images work. Until we loop around to the corrupt jpg > again. > > Any ideas what's going on? > > Thanks, > Chris > > http://www.fetidcascade.com/ > From lroubeyrie at limair.asso.fr Thu Jan 27 16:08:54 2005 From: lroubeyrie at limair.asso.fr (Lionel Roubeyrie) Date: Thu Jan 27 16:10:06 2005 Subject: [Image-SIG] Broken Pipe In-Reply-To: <200501271208.58142.lroubeyrie@limair.asso.fr> References: <200501271208.58142.lroubeyrie@limair.asso.fr> Message-ID: <200501271608.54192.lroubeyrie@limair.asso.fr> Hi again, after debugging time, ghostscript doesn't like to be invoked with the "- >/dev/tty 2>/dev/tty" option in mod_python with apache, because mod_python doesn't open a real tty. Then "gs.write(s)" crashes with a broken pipe. I have modified the Ghostscript method to revoke this : ################################## 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 outfile = tempfile.mktemp() infile = tempfile.mktemp() # Build ghostscript command command = ["gs", "-q", # quite mode "-g%dx%d" % size, # set output geometry (pixels) "-dNOPAUSE -dSAFER -dBATCH", # don't pause between pages, safe mode "-sDEVICE=ppmraw", # ppm driver "-sOutputFile=%s" % outfile,# output outfile infile] command = string.join(command) # push data through ghostscript try: ps = open(infile, 'w') # adjust for image origin if bbox[0] != 0 or bbox[1] != 0: ps.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) ps.write(s) ps.close() os.popen(command) im = Image.core.open_ppm(outfile) finally: try: os.unlink(outfile) os.unlink(infile) except: pass return im ################################ Now it works well. Hope it helps (Zopemen seem to have the same problem ...) Lionel, aka Joshua_fr From areopagus125 at yahoo.com Thu Jan 27 23:29:01 2005 From: areopagus125 at yahoo.com (David Smith) Date: Thu Jan 27 23:29:05 2005 Subject: [Image-SIG] 2-band image Message-ID: <20050127222901.63365.qmail@web12210.mail.yahoo.com> I wrote a C++ program that internally produces what amounts to a 2-band image. (The bands are the horizontal and vertical components of a displacement field over the plane.) I added code using libtiff to write out a Tiff file that has two 1-byte samples per pixel. PIL won't accept this file, raising an exception: File "C:\Python23\lib\site-packages\PIL\Image.py", line 1571, in open raise IOError("cannot identify image file") I know the file is basically all right, if unusual. Microsoft's Windows Picture and Fax Viewer displays the first band, as does Microsoft Photo Editor. Gimp displays it at the expected size, although it appears to be showing alternating band samples interleaved across the image. I had thought maybe I could read the image into PIL and call seek() to select the band. But, I guess the only multiband images in PIL are the predefined RGB, RGBA, CMYK, and YCbCr. Is that right, or is there a more general multiband implementation underlying these that I could utilize? How do you suggest I store multiband images, considering that I may need to store 16 bits per sample in the future? adTHANKSvance, David Smith __________________________________ Do you Yahoo!? All your favorites on one personal page – Try My Yahoo! http://my.yahoo.com From fredrik at pythonware.com Fri Jan 28 09:18:55 2005 From: fredrik at pythonware.com (Fredrik Lundh) Date: Fri Jan 28 09:19:08 2005 Subject: [Image-SIG] Re: 2-band image References: <20050127222901.63365.qmail@web12210.mail.yahoo.com> Message-ID: David Smith wrote: > I wrote a C++ program that internally produces what > amounts to a 2-band image. (The bands are the > horizontal and vertical components of a displacement < field over the plane.) I added code using libtiff to > write out a Tiff file that has two 1-byte samples per > pixel. PIL won't accept this file, raising an > exception: can you mail me an example? From areopagus125 at yahoo.com Fri Jan 28 19:29:36 2005 From: areopagus125 at yahoo.com (David Smith) Date: Fri Jan 28 19:29:45 2005 Subject: [Image-SIG] Re: 2-band image In-Reply-To: Message-ID: <20050128182936.74405.qmail@web12205.mail.yahoo.com> > David Smith wrote: > > > I wrote a C++ program that internally produces > what > > amounts to a 2-band image. (The bands are the > > horizontal and vertical components of a > displacement > < field over the plane.) I added code using libtiff > to > > write out a Tiff file that has two 1-byte samples > per > > pixel. PIL won't accept this file, raising an > > exception: > > can you mail me an example? > > I've emailed Fredrik an example off list. Continuing to look over Libtiff and PIL documentation, it looks to me like the best ways to store 2-band images is to drop them into RGB, or to use image sequences. -- David __________________________________ Do you Yahoo!? Yahoo! Mail - Helps protect you from nasty viruses. http://promotions.yahoo.com/new_mail From python at bnardone.com Fri Jan 28 12:26:48 2005 From: python at bnardone.com (python@bnardone.com) Date: Fri Jan 28 21:24:54 2005 Subject: [Image-SIG] Using PIL for background display in OGL/Python Message-ID: <20050128202454.0667A1E4004@bag.python.org> I've just begun working OGL with Python and had a question about PIL. Specifically, I've been using it to load .png's as textures, and now have a need to draw other images (.jpg, .png) as background images. I'm interested in using something along the lines of: glPixelStorei(GL_UNPACK_ALIGNMENT,4); glRasterPos2i(0,600) glDrawPixels(800,600,GL_RGBA,*someBitmapSet*) But I am unsure as to how to get the *someBitmapSet* out of the object returned by someImage.tostring("raw", "RGBA", 0, -1) image = numarray.array(numarray.fromstring(image, numarray.Byte)) I've tried glDrawPixels(800,600,GL_RGBA,GL_UNSIGNED_BYTE,image) to no avail. Is this possible? Am I headed in the right direction? From mike at dmawebapps.com Fri Jan 28 22:33:26 2005 From: mike at dmawebapps.com (Michael De Paola) Date: Fri Jan 28 22:33:40 2005 Subject: [Image-SIG] UNSUBSCRIBE In-Reply-To: <20050128202454.0667A1E4004@bag.python.org> References: <20050128202454.0667A1E4004@bag.python.org> Message-ID: On Jan 28, 2005, at 12:26 PM, wrote: > I've just begun working OGL with Python and had a question about PIL. > Specifically, I've been using it to load .png's as textures, and now > have a need > to draw other images (.jpg, .png) as background images. I'm interested > in using > something along the lines of: > glPixelStorei(GL_UNPACK_ALIGNMENT,4); > glRasterPos2i(0,600) > glDrawPixels(800,600,GL_RGBA,*someBitmapSet*) > > But I am unsure as to how to get the *someBitmapSet* out of the object > returned by > someImage.tostring("raw", "RGBA", 0, -1) > image = numarray.array(numarray.fromstring(image, numarray.Byte)) > > I've tried > glDrawPixels(800,600,GL_RGBA,GL_UNSIGNED_BYTE,image) > to no avail. > > Is this possible? Am I headed in the right direction? > > > > _______________________________________________ > Image-SIG maillist - Image-SIG@python.org > http://mail.python.org/mailman/listinfo/image-sig > From bob at redivi.com Fri Jan 28 22:58:29 2005 From: bob at redivi.com (Bob Ippolito) Date: Fri Jan 28 22:58:36 2005 Subject: [Image-SIG] Using PIL for background display in OGL/Python In-Reply-To: <20050128202454.0667A1E4004@bag.python.org> References: <20050128202454.0667A1E4004@bag.python.org> Message-ID: On Jan 28, 2005, at 12:26, wrote: > I've just begun working OGL with Python and had a question about PIL. > Specifically, I've been using it to load .png's as textures, and now > have a need > to draw other images (.jpg, .png) as background images. I'm interested > in using > something along the lines of: > glPixelStorei(GL_UNPACK_ALIGNMENT,4); > glRasterPos2i(0,600) > glDrawPixels(800,600,GL_RGBA,*someBitmapSet*) > > But I am unsure as to how to get the *someBitmapSet* out of the object > returned by > someImage.tostring("raw", "RGBA", 0, -1) > image = numarray.array(numarray.fromstring(image, numarray.Byte)) > > I've tried > glDrawPixels(800,600,GL_RGBA,GL_UNSIGNED_BYTE,image) > to no avail. > > Is this possible? Am I headed in the right direction? You shouldn't be using glDrawPixels.. it's almost always slow. You want to draw it to a texture, and then render the texture to a rect. There are examples out there for getting a PIL image into an OpenGL texture, but I can't think of anything off the top of my head. -bob From python at bnardone.com Fri Jan 28 17:16:19 2005 From: python at bnardone.com (python@bnardone.com) Date: Sat Jan 29 02:14:28 2005 Subject: [Image-SIG] Using PIL for background display in OGL/Python Message-ID: <20050129011426.912FE1E4004@bag.python.org> Ok, that's what I'm doing currently, but was (obviously mis-) informed that glDrawPixels would be faster. Thanks a lot for your quick response. Cheers. On Fri, 28 Jan 2005 16:58 , Bob Ippolito sent: > >On Jan 28, 2005, at 12:26, python@bnardone.com> wrote: > >> I've just begun working OGL with Python and had a question about PIL. >> Specifically, I've been using it to load .png's as textures, and now >> have a need >> to draw other images (.jpg, .png) as background images. I'm interested >> in using >> something along the lines of: >> glPixelStorei(GL_UNPACK_ALIGNMENT,4); >> glRasterPos2i(0,600) >> glDrawPixels(800,600,GL_RGBA,*someBitmapSet*) >> >> But I am unsure as to how to get the *someBitmapSet* out of the object >> returned by >> someImage.tostring("raw", "RGBA", 0, -1) >> image = numarray.array(numarray.fromstring(image, numarray.Byte)) >> >> I've tried >> glDrawPixels(800,600,GL_RGBA,GL_UNSIGNED_BYTE,image) >> to no avail. >> >> Is this possible? Am I headed in the right direction? > >You shouldn't be using glDrawPixels.. it's almost always slow. You >want to draw it to a texture, and then render the texture to a rect. >There are examples out there for getting a PIL image into an OpenGL >texture, but I can't think of anything off the top of my head. > >-bob > > From pascor22234 at yahoo.com Sat Jan 29 21:24:02 2005 From: pascor22234 at yahoo.com (Ray Pasco) Date: Sat Jan 29 21:24:05 2005 Subject: [Image-SIG] Where is the indexed PNG alpha table ? Message-ID: <20050129202402.61666.qmail@web52706.mail.yahoo.com> Subject: Re: [Image-SIG] Where is the indexed PNG alpha table ? Date: Thu, 27 Jan 2005 13:58:18 +1300 From: Douglas Bagnall To: Ray Pasco CC: image-sig@python.org Ray Pasco wrote: >> I am wondering how to get at the alpha layer table that goes along >> with an indexed PNG image. >> > >I believe that alpha in an indexed PNG is not stored as a channel, but > as indexed colours. In other words, the index is not of RGB values, but > of RGBA values. If you only have full transparancy, there'll only be >one index value for it, and PIL will probably do the right thing with >>> im = Image.open('indexed.png').convert('RGBA') > but I'm not sure how it would cope with multiple semi-transparent values > -- I don't know how to make such an image to test with. douglas I asked this because I just learned that indexed PNG images *can* have a separate "alpha" index table in parallel with the color index table. "Indexed im>ages with transparency actually contain a table specifying the transparency of each indexed colour. However, the size of that table can be less than the number of indexed colour, in which case missing values are assumed fully opaque. The transparency table can contain only one value, but in this case, it always correspond to the first colour of the palette. It does not have to be fully transparent either. Any value from 0 (fully transparent) to 255 (fully opaque) is allowed. See http://www.libpng.org/pub/png/spec/iso/index-object.html#11tRNS". Also see in section 4.4, first item e in: http://www.libpng.org/pub/png/spec/iso/index-object.html#4Concepts.PNGImage Is this alpha index table not implemented in PIL (yet) ? Ray Pasco __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From douglas at paradise.net.nz Sun Jan 30 10:13:23 2005 From: douglas at paradise.net.nz (Douglas Bagnall) Date: Sun Jan 30 10:13:22 2005 Subject: [Image-SIG] Where is the indexed PNG alpha table ? In-Reply-To: <20050129202402.61666.qmail@web52706.mail.yahoo.com> References: <20050129202402.61666.qmail@web52706.mail.yahoo.com> Message-ID: <41FCA533.2030405@paradise.net.nz> I wrote: >> In other words, the index is >> not of RGB values, but of RGBA values. Ray Pasco wrote: > I asked this because I just learned that indexed PNG > images *can* have a > separate "alpha" index table in parallel with the > color index table. Yes, and these two sentences amount to the same thing -- "in parallel" is an implementation detail of the index. You don't get more information out of it. If you have such an image (I can't seem to make one with either the Gimp or PIL), have you tried: >>> im = Image.open('indexed.png').convert('RGBA') >>> r, g, b, a = im.split() >>> a.save('alpha.png') alpha.png should be greyscale image containing only the alpha information from the original image. cheers, Douglas From NadavH at VisionSense.com Sun Jan 2 13:08:35 2005 From: NadavH at VisionSense.com (Nadav Horesh) Date: Mon Jan 31 12:04:12 2005 Subject: [Image-SIG] Deformer Object In-Reply-To: <012501c4ed08$d3c438f0$6602a8c0@securia.com> References: <012501c4ed08$d3c438f0$6602a8c0@securia.com> Message-ID: <41D7E3C5.4050800@VisionSense.com> An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20050102/8d8eeeda/attachment.htm From Marc-Elian.Begin at cern.ch Tue Jan 11 22:17:02 2005 From: Marc-Elian.Begin at cern.ch (Marc-Elian Begin) Date: Mon Jan 31 12:04:13 2005 Subject: [Image-SIG] Error with PIL on RH-7.3 Message-ID: Hi, I'm running into the following error running PIL 1.1.4 on Red-Hat 7.3, trying to "import _imaging" ImportError: /lib/i686/libc.so.6: version `GLIBC_2.3' not found (required by ./_imaging.so) It works fine on Red-Hat Enterprise Linux, CentOs and Scientific Linux. I'm running Python 2.2.2 Any help would be great. Cheers, Meb -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20050111/79c56a03/attachment.html From nick.bulitka at pixelink.com Thu Jan 20 22:30:33 2005 From: nick.bulitka at pixelink.com (Nick Bulitka) Date: Mon Jan 31 12:04:14 2005 Subject: [Image-SIG] PIL for Python 2.4 Message-ID: <9770F0C4ADDFD211B6B800A0C9ED958201706A66@vitanasrv2> Hi. Is there a version of PIL for the recently released version of Python v2.4? What is the expected timeframe? Regards, Nick Bulitka -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20050120/6284e150/attachment.htm From ChristianJ at implicitnetworks.com Sat Jan 22 00:25:03 2005 From: ChristianJ at implicitnetworks.com (Christian Jensen) Date: Mon Jan 31 12:04:15 2005 Subject: [Image-SIG] Bug Message-ID: <148D64496E077C4DAF1FA4BBC6F74DA625164C@corp1.implicit.implicitnetworks.com> I don't think I need support... unless I am doing something wrong here :-) Please direct me: I have a script that converts a 32 bit RGBA image over to another 32 bit RGBA image, but in the middle, it reduces the number of colors for each plane. This allows for pre-dithering when outputting to 15 and 16 bit displays. The bug I have noticed is that the values get shifted during the "quantize" function, even when using a pure linear palette. I discovered this when I fed in an image that had an input alpha value of 255 and it came back out at 252. Here is the script: def RGBADither(bands_colors = [32.0,64.0,32.0,256.0], input_file="", output_file=""): import Image, ImagePalette im = Image.open(input_file) bands = im.split() outbands= [0,0,0,0] for band in range(len(bands)): data = "" for i in range(256): v = chr(int((int((i/256.0)*bands_colors[band])/bands_colors[band])*256.0)) data += chr(v) + chr(v) + chr(v) p = ImagePalette.raw("RGB", data) pimage = Image.new("P", (1, 1)) pimage.palette = p tmp = bands[band] tmp = tmp.convert(mode="RGB") tmp = tmp.quantize(palette=pimage) tmp = tmp.convert(mode="L") outbands[band] = tmp tmp.save("band%s.png"%band) out = Image.merge("RGBA", outbands) out.save(output_file) -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20050121/1343deb2/attachment.html From pascor at hotpop.com Thu Jan 27 02:33:16 2005 From: pascor at hotpop.com (Ray Pasco) Date: Mon Jan 31 12:04:16 2005 Subject: [Fwd: Re: [Image-SIG] Where is the indexed PNG alpha table ?] Message-ID: <41F844DC.60105@hotpop.com> -------- Original Message -------- Subject: Re: [Image-SIG] Where is the indexed PNG alpha table ? Date: Thu, 27 Jan 2005 13:58:18 +1300 From: Douglas Bagnall To: Ray Pasco CC: image-sig@python.org References: <41F82308.9030507@hotpop.com> Ray Pasco wrote: > I am wondering how to get at the alpha layer table that goes along > with an indexed PNG image. > I believe that alpha in an indexed PNG is not stored as a channel, but as indexed colours. In other words, the index is not of RGB values, but of RGBA values. If you only have full transparancy, there'll only be one index value for it, and PIL will probably do the right thing with >>> im = Image.open('indexed.png').convert('RGBA') but I'm not sure how it would cope with multiple semi-transparent values -- I don't know how to make such an image to test with. douglas Indexed images with transparency actually contain a table specifying the transparency of each indexed colour. However, the size of that table can be less than the number of indexed colours, in which case missing values are assumed fully opaque. The transparency table can contain only one value, but in this case, it always correspond to the first colour of the palette. It does not have to be fully transparent either. Any value from 0 (fully transparent) to 255 (fully opaque) is allowed. See http://www.libpng.org/pub/png/spec/iso/index-object.html#11tRNS Ray -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20050126/744e64e6/attachment.htm From pascor at hotpop.com Fri Jan 28 02:09:10 2005 From: pascor at hotpop.com (Ray Pasco) Date: Mon Jan 31 12:04:16 2005 Subject: [Image-SIG] Where is the indexed PNG alpha table ? Message-ID: <41F990B6.5070803@hotpop.com> Subject: Re: [Image-SIG] Where is the indexed PNG alpha table ? Date: Thu, 27 Jan 2005 13:58:18 +1300 From: Douglas Bagnall To: Ray Pasco CC: image-sig@python.org Ray Pasco wrote: > I am wondering how to get at the alpha layer table that goes along > with an indexed PNG image. > I believe that alpha in an indexed PNG is not stored as a channel, but as indexed colours. In other words, the index is not of RGB values, but of RGBA values. If you only have full transparancy, there'll only be one index value for it, and PIL will probably do the right thing with >>> im = Image.open('indexed.png').convert('RGBA') but I'm not sure how it would cope with multiple semi-transparent values -- I don't know how to make such an image to test with. douglas I asked this because I just learned that indexed PNG images *can* have a separate "alpha" index table in parallel with the color index table. "Indexed images with transparency actually contain a table specifying the transparency of each indexed colour. However, the size of that table can be less than the number of indexed colour, in which case missing values are assumed fully opaque. The transparency table can contain only one value, but in this case, it always correspond to the first colour of the palette. It does not have to be fully transparent either. Any value from 0 (fully transparent) to 255 (fully opaque) is allowed. See http://www.libpng.org/pub/png/spec/iso/index-object.html#11tRNS". Also see in section 4.4, first item e in: http://www.libpng.org/pub/png/spec/iso/index-object.html#4Concepts.PNGImage Is this alpha index table not implemented in PIL (yet) ? Ray Pasco -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20050127/ef815eaa/attachment.html From pascor at hotpop.com Fri Jan 28 03:32:06 2005 From: pascor at hotpop.com (Ray Pasco) Date: Mon Jan 31 12:04:17 2005 Subject: [Image-SIG] Where is the indexed PNG alpha table ? Message-ID: <41F9A426.3000507@hotpop.com> Subject: Re: [Image-SIG] Where is the indexed PNG alpha table ? Date: Thu, 27 Jan 2005 13:58:18 +1300 From: Douglas Bagnall To: Ray Pasco CC: image-sig@python.org Ray Pasco wrote: > I am wondering how to get at the alpha layer table that goes along > with an indexed PNG image. > I believe that alpha in an indexed PNG is not stored as a channel, but as indexed colours. In other words, the index is not of RGB values, but of RGBA values. If you only have full transparancy, there'll only be one index value for it, and PIL will probably do the right thing with >>> im = Image.open('indexed.png').convert('RGBA') but I'm not sure how it would cope with multiple semi-transparent values -- I don't know how to make such an image to test with. douglas I asked this because I just learned that indexed PNG images *can* have a separate "alpha" index table in parallel with the color index table. "Indexed images with transparency actually contain a table specifying the transparency of each indexed colour. However, the size of that table can be less than the number of indexed colour, in which case missing values are assumed fully opaque. The transparency table can contain only one value, but in this case, it always correspond to the first colour of the palette. It does not have to be fully transparent either. Any value from 0 (fully transparent) to 255 (fully opaque) is allowed. See http://www.libpng.org/pub/png/spec/iso/index-object.html#11tRNS". Also see in section 4.4, first item e in: http://www.libpng.org/pub/png/spec/iso/index-object.html#4Concepts.PNGImage Is this alpha index table not implemented in PIL (yet) ? Ray Pasco -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20050127/ed66752e/attachment.htm From thomasj at eworld.hu Mon Jan 31 12:12:24 2005 From: thomasj at eworld.hu (Tamas J) Date: Mon Jan 31 12:12:28 2005 Subject: [Image-SIG] TIFFG3 Message-ID: <648147578.20050131121224@eworld.hu> Hello! Does anybody have G3 TIFF port for the upcoming PIL-1.1.5? Thanks in advance, Tamas ps: I see G3 support for PIL-1.1.4 but it looks to be very different and my knowledge is to weak to port it for 1.1.5... From steve at holdenweb.com Mon Jan 31 13:26:42 2005 From: steve at holdenweb.com (Steve Holden) Date: Mon Jan 31 13:32:09 2005 Subject: [Image-SIG] PIL for Python 2.4 In-Reply-To: <9770F0C4ADDFD211B6B800A0C9ED958201706A66@vitanasrv2> References: <9770F0C4ADDFD211B6B800A0C9ED958201706A66@vitanasrv2> Message-ID: <41FE2402.6090708@holdenweb.com> Nick Bulitka wrote: > Hi. > > Is there a version of PIL for the recently released version of Python > v2.4? What is the expected timeframe? > > > Regards, > Nick Bulitka > The effbot always knows what we need :-) See http://effbot.org/downloads/#PIL regards Steve -- Steve Holden http://www.holdenweb.com/ Python Web Programming http://pydish.holdenweb.com/ Holden Web LLC +1 703 861 4237 +1 800 494 3119 From gwidion at mpc.com.br Mon Jan 31 15:16:54 2005 From: gwidion at mpc.com.br (Joao S. O. Bueno Calligaris) Date: Mon Jan 31 15:17:39 2005 Subject: [Image-SIG] Where is the indexed PNG alpha table ? In-Reply-To: <41FCA533.2030405@paradise.net.nz> References: <20050129202402.61666.qmail@web52706.mail.yahoo.com> <41FCA533.2030405@paradise.net.nz> Message-ID: <200501311216.54592.gwidion@mpc.com.br> Hi, I actually have been working in a Python plug-in for the GIMP to be able to save indexed PNGs with more than one transp. level. I do not use PIL at all, instead, I rely on teh GIMP to save tjhe PNG, na dthem, open the PNG as a binary file, according to the PNG specs, and write out the transparency info. I do n ot recall now if there is more than a way of doing this (like having a 4 component palette). But what my progra does is write a 256 (or less) byte separate chiunk (named "tRNS" within the png), with transparency information for each color on the palette. I hope this helps. The plug-in is in 'maintanance' right now - but if anyone here need it, I think I can fix it early next week. Ah, I shall have a working - though slow - version somewere. Regards, JS -><- On Sunday 30 January 2005 07:13, Douglas Bagnall wrote: > I wrote: > >> In other words, the index is > >> not of RGB values, but of RGBA values. > > Ray Pasco wrote: > > I asked this because I just learned that indexed PNG > > images *can* have a > > separate "alpha" index table in parallel with the > > color index table. > > Yes, and these two sentences amount to the same thing -- "in > parallel" is an implementation detail of the index. You don't get > more information out of it. > > If you have such an image (I can't seem to make one with either the > Gimp > > or PIL), have you tried: > >>> im = Image.open('indexed.png').convert('RGBA') > >>> r, g, b, a = im.split() > >>> a.save('alpha.png') > > alpha.png should be greyscale image containing only the alpha > information from the original image. > > > cheers, > > Douglas > _______________________________________________ > Image-SIG maillist - Image-SIG@python.org > http://mail.python.org/mailman/listinfo/image-sig From gwidion at mpc.com.br Mon Jan 31 15:24:21 2005 From: gwidion at mpc.com.br (Joao S. O. Bueno Calligaris) Date: Mon Jan 31 15:25:04 2005 Subject: [Image-SIG] Streaming Images In-Reply-To: <019601c4ef7a$42514f10$6602a8c0@securia.com> References: <019601c4ef7a$42514f10$6602a8c0@securia.com> Message-ID: <200501311224.21499.gwidion@mpc.com.br> On Friday 31 December 2004 18:49, Jalil Feghhi wrote: > I would like to create an image on the fly and stream it to the > browser. Is there any information on how to do this exactly using > PIL (or any other library)? In my python program, I am converting a > random text to an image. I can serve it to the browser now but I > hae to save it to a file. I like to stream it and not save it to > file system. How is this possible? > Hi. I do that with PIL - all you have to do is to send to the HTTP server a http header line apropriate for the data you are serving. If you are writing Python CGI, the server reads your stdout, so just doing: print "Content-type: image/png\n\n" prior to outputing image data should do it. Cheers, JS -><- > Regards, > > -Jalil From stuff2 at obcore.com Mon Jan 31 15:25:18 2005 From: stuff2 at obcore.com (Winston Wolff) Date: Mon Jan 31 15:25:30 2005 Subject: [Image-SIG] Bug in palette mode text drawing Message-ID: <6d2c0561a9014c1427c392466eb8f5d9@obcore.com> Skipped content of type multipart/alternative-------------- next part -------------- A non-text attachment was scrubbed... Name: ImageDrawTest.py Type: application/text Size: 4441 bytes Desc: not available Url : http://mail.python.org/pipermail/image-sig/attachments/20050131/b2e3e1e4/ImageDrawTest.bin -------------- next part -------------- Skipped content of type multipart/alternative