From olau at iola.dk Fri Apr 4 11:31:03 2008 From: olau at iola.dk (Ole Laursen) Date: Fri, 4 Apr 2008 11:31:03 +0200 Subject: [Image-SIG] Bug in rotate with expand=True Message-ID: Hi, Try this import Image, ImageDraw i = Image.new("RGBA", (100, 100), (255, 0, 0, 0)) draw = ImageDraw.Draw(i) draw.line([(0, 50), (100, 50)], fill=(255, 0, 0), width=3) i.save("original.png") i.rotate(15, Image.BICUBIC, True).save("enlarged.png") i.rotate(15, Image.BICUBIC, False).save("not-enlarged.png") Then take a look at "enlarged.png". Contrary to "not-enlarged.png", it's not anti-aliased in spite of both having Image.BICUBIC set. I believe this is a bug in rotate(). It appears to be a question of line 1320 in Image.py return self.transform((w, h), AFFINE, matrix) missing the resample parameter return self.transform((w, h), AFFINE, matrix, resample) (Please keep the CC as I'm not subscribed to the list.) -- Ole Laursen http://www.iola.dk/ From fredrik at pythonware.com Fri Apr 4 15:46:33 2008 From: fredrik at pythonware.com (Fredrik Lundh) Date: Fri, 04 Apr 2008 15:46:33 +0200 Subject: [Image-SIG] PIL builds for Mac OS X Message-ID: Ok, quick question: what's the situation when it comes to prebuilt PIL releases for Mac OS X? I keep seeing (and getting) requests from people failing to build PIL from sources, but I'm not sure where to point them (and as usual, people hardly ever follow up when you point them in some direction, so it's hard to tell what's working or not). Is there a "just grab this and install it as usual" build somewhere that I should link to from pythonware.com? From janssen at parc.com Fri Apr 4 18:12:13 2008 From: janssen at parc.com (Bill Janssen) Date: Fri, 4 Apr 2008 09:12:13 PDT Subject: [Image-SIG] PIL builds for Mac OS X In-Reply-To: References: Message-ID: <08Apr4.091221pdt."58696"@synergy1.parc.xerox.com> I usually just build from source: setenv CPPFLAGS "-I${distdir}/include" setenv LDFLAGS "-L${distdir}/lib" setenv CXXFLAGS "-I${distdir}/include" rm -f /tmp/foo-mac-uplib cp setup.py /tmp/foo-mac-uplib sed -e "s;/sw;${distdir};" < /tmp/foo-mac-uplib > setup.py python setup.py build python setup.py install --prefix=${distdir} The fact that Fink (/sw) is mentioned in setup.py is an issue, and the reason for the above scripting. I find Fink more of a hindrance than a help. This, of course, is on a machine with libpng, libjpeg, libtiff, freetype, and t1lib pre-installed in ${distdir}. In my experience, it's finding and/or installing these libraries correctly that's the issue when building PIL. Bill From norman at khine.net Fri Apr 4 17:20:49 2008 From: norman at khine.net (Norman Khine) Date: Fri, 04 Apr 2008 17:20:49 +0200 Subject: [Image-SIG] PIL builds for Mac OS X In-Reply-To: References: Message-ID: <47F64751.7090501@khine.net> I have built PIL from source with no problem on OSX 10.4.10 and also 10.3 version as well. What sort of errors are people having? Also may be of use: http://apps.carleton.edu/curricular/cs/resources/source/PILinstallation/ Norman Fredrik Lundh wrote: > Ok, quick question: what's the situation when it comes to prebuilt PIL > releases for Mac OS X? > > I keep seeing (and getting) requests from people failing to build PIL > from sources, but I'm not sure where to point them (and as usual, people > hardly ever follow up when you point them in some direction, so it's > hard to tell what's working or not). > > Is there a "just grab this and install it as usual" build somewhere that > I should link to from pythonware.com? > > > > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > From rowen at cesmail.net Fri Apr 4 18:37:33 2008 From: rowen at cesmail.net (Russell E. Owen) Date: Fri, 04 Apr 2008 09:37:33 -0700 Subject: [Image-SIG] PIL builds for Mac OS X References: Message-ID: In article , Fredrik Lundh wrote: > Ok, quick question: what's the situation when it comes to prebuilt PIL > releases for Mac OS X? > > I keep seeing (and getting) requests from people failing to build PIL > from sources, but I'm not sure where to point them (and as usual, people > hardly ever follow up when you point them in some direction, so it's > hard to tell what's working or not). > > Is there a "just grab this and install it as usual" build somewhere that > I should link to from pythonware.com? PIL is one of many prebuilt packages available from: -- Russell From fredrik at pythonware.com Fri Apr 4 18:39:04 2008 From: fredrik at pythonware.com (Fredrik Lundh) Date: Fri, 04 Apr 2008 18:39:04 +0200 Subject: [Image-SIG] PIL builds for Mac OS X In-Reply-To: <47F64751.7090501@khine.net> References: <47F64751.7090501@khine.net> Message-ID: Norman Khine wrote: > I have built PIL from source with no problem on OSX 10.4.10 and also > 10.3 version as well. > > What sort of errors are people having? usually just troubles getting the right libraries, and getting the PIL build process to find them (cf Bill's reply). > Also may be of use: > http://apps.carleton.edu/curricular/cs/resources/source/PILinstallation/ looks like a nice summary. but prebuilt "click and go" versions for *all* widely used Mac OS X versions (whatever they are) would be nice to have... From janssen at parc.com Fri Apr 4 20:05:28 2008 From: janssen at parc.com (Bill Janssen) Date: Fri, 4 Apr 2008 11:05:28 PDT Subject: [Image-SIG] PIL builds for Mac OS X In-Reply-To: References: <47F64751.7090501@khine.net> Message-ID: <08Apr4.110536pdt."58696"@synergy1.parc.xerox.com> Here's a fuller excerpt from my build script, in case it's helpful to someone. This is part of how I build the Mac installer for UpLib -- one of the side-effects of installing UpLib on a Mac is a full-fledged PIL installation in the system Python. I unpack PIL and all the prereq packages in /tmp, and go to work. ${distdir} could be "/usr/local"; for UpLib I use "/Library/UpLib/". I'm omitting large chunks; I also build Lucene, xpdf, htmldoc, etc. Bill ---------------------------------------------------------- cd libpng-* ./configure --prefix=${distdir} make make install cd ../jpeg* ./configure --prefix=${distdir} make make install make install-lib make install-headers ranlib ${distdir}/lib/libjpeg.a setenv CPPFLAGS "-I${distdir}/include" setenv LDFLAGS "-L${distdir}/lib" setenv CXXFLAGS "-I${distdir}/include" cd ../jbig2dec* ./configure --prefix=${distdir} make make install cd ../ghostscript-8* ln -s ../jpeg-6b ./jpeg # Macs may not have X11, so make sure not to link it in by accident ./configure --without-x --prefix=${distdir} make make install cd ../fonts install -m 444 * ${distdir}/share/ghostscript/fonts cd ../tiff-* ./configure --prefix=${distdir} --without-x make make install cd ../freetype-2.* # first, get rid of erroneous mac flag cp include/freetype/config/ftconfig.h /tmp/foo-mac-uplib rm -f include/freetype/config/ftconfig.h sed -e 's/#define FT_MACINTOSH 1/#undef FT_MACINTOSH/' < /tmp/foo-mac-uplib > include/freetype/config/ftconfig.h # next, enable the bytecode interpreter rm -f /tmp/foo-mac-uplib cp include/freetype/config/ftoption.h /tmp/foo-mac-uplib rm -f include/freetype/config/ftoption.h sed -e 's;/\* #define TT_CONFIG_OPTION_BYTECODE_INTERPRETER \*/;#define TT_CONFIG_OPTION_BYTECODE_INTERPRETER;' < /tmp/foo-mac-uplib > include/freetype/config/ftoption.h # now build ./configure --prefix=${distdir} make make install cp ${distdir}/include/ft2build.h ${distdir}/include/freetype2/ # for xpdf cd ../t1lib-5.* ./configure --without-x --without-athena --prefix=${distdir} make without_doc make install cd ../Imaging-1.1.* rm -f /tmp/foo-mac-uplib cp setup.py /tmp/foo-mac-uplib sed -e "s;/sw;${distdir};" < /tmp/foo-mac-uplib > setup.py python setup.py build python setup.py install --prefix=${distdir} From fredrik at pythonware.com Fri Apr 4 20:14:47 2008 From: fredrik at pythonware.com (Fredrik Lundh) Date: Fri, 04 Apr 2008 20:14:47 +0200 Subject: [Image-SIG] im.show does not show, and Tkinter isn't displaying my jpg image In-Reply-To: <200803170745.30937.G.Kloss@massey.ac.nz> References: <16074034.post@talk.nabble.com> <200803161015.08245.frederic.mantegazza@gbiloba.org> <200803170745.30937.G.Kloss@massey.ac.nz> Message-ID: Guy K. Kloss wrote: > I've been thinking already that xv is pretty much a tool of the past. I've > circumnavigated this problem on my Linux box by sym-linking /usr/local/xv > to /usr/bin/display (of ImageMagick). Maybe it would be more appropriate > for "moder times" to replace xv with display within PIL for show() on UN*X > platforms? indeed (and if someone wants to produce a well-tested patch for this, be my guest). note that as a workaround, you can pass in the command you want to use: im.show(command="display") or override the Image._showxv method, via "monkey patching", e.g. import Image def myshow(image, title, *args): f = os.popen("mydisplayprogram -") image.save(f, "PNG") Image._showxv = myshow From fredrik at pythonware.com Fri Apr 4 20:33:49 2008 From: fredrik at pythonware.com (Fredrik Lundh) Date: Fri, 04 Apr 2008 20:33:49 +0200 Subject: [Image-SIG] PIL builds for Mac OS X In-Reply-To: References: Message-ID: Russell E. Owen wrote: > PIL is one of many prebuilt packages available from: > does the "10.3.9 and later" also apply to the latest OS X releases (leopard etc)? and do these work with Apple's stock Python, or do you need the Python package from that site as well? (I would have tested it myself, but I'm afraid there's a noticable shortage of OS X machines in my office...) From crschmidt at metacarta.com Fri Apr 4 21:50:36 2008 From: crschmidt at metacarta.com (Christopher Schmidt) Date: Fri, 4 Apr 2008 15:50:36 -0400 Subject: [Image-SIG] PIL builds for Mac OS X In-Reply-To: References: Message-ID: <20080404195035.GA23180@metacarta.com> On Fri, Apr 04, 2008 at 08:33:49PM +0200, Fredrik Lundh wrote: > Russell E. Owen wrote: > > > PIL is one of many prebuilt packages available from: > > > > does the "10.3.9 and later" also apply to the latest OS X releases > (leopard etc)? and do these work with Apple's stock Python, or do you > need the Python package from that site as well? Yes, and the latter. Regards, -- Christopher Schmidt MetaCarta From Chris.Barker at noaa.gov Sat Apr 5 00:02:00 2008 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Fri, 04 Apr 2008 15:02:00 -0700 Subject: [Image-SIG] PIL builds for Mac OS X In-Reply-To: References: Message-ID: <47F6A558.6070107@noaa.gov> Fredrik, Thanks for bringing this up -- the plethora of options for Python stuff on OS-X is a constant nightmare for new users. I'm still confused as to why it's so much harder for new users than Windows, but I guess it's because OS-X provides almost easy-enough ways to get unix-y libs, etc, whereas building your own is out of the question for many (most?) Windows users. However, the many options of fink, macports, plain old build from tarball, assorted library Frameworks, PPC, Intel, etc. really creates a support nightmare for developers of open-source packages. This has been discussed a lot on the python-mac lists, and I think a more or less consensus was reached for supporting easy installers for newbies: 1) Use the "MacPython Universal Framework" build available from python.org and pythonmac.org/packages 2) Packages or binary eggs should be made available for that Python that are statically linked against any non-apple supplied libs (libpng, etc.). That's what's up at pythonmac.org/packages. However, this has been complicated by three things: 1) pythonmac.org/packages isn't being as well maintained as it once was. In fact, you can't even find a link to it from pythonmac.org, as that now re-directs to http://wiki.python.org. I think this is because Bob Ippolito is busy with other things, and that was primarily his baby. 2) Apple is now shipping a good-enough python. They've shipped python for years, but it was always out of date, slightly broken, and they never updated it. With 10.5, they have a mostly fully functional up to date Python, so people are using that now. That means that people can do something different on 10.5 than older versions. There is a way to install a single package that will work with either MacPython2.5 or Apple's Python2.5, but it requires at least some symlink magic, and there are odd issues with overriding (or not) the version of a package that Apple has provided. 3) More and more package developers are providing binary *.dmgs or eggs themselves, rather than relying on pythonmac.org/packages -- this is generally a good thing, but it does mean that there is less need for the repository, so it sees less maintenance. Anyway, here is my suggestion for PIL: First Choice: Provide a binary download on the PIL site for at least Universal MacPython2.5 -- the one distributed by python.org. For PIL version 1.1.6 you can get it here: http://pythonmac.org/packages/py25-fat/index.html For future versions, post a request to this list and/or the pythonmac list, and I'm sure you can get someone to build one for you that you can post. Do make sure that it's a Universal Build(PPC+Intel) and it's statically linked against external libs (also Universal). It might be nice to have another one for Python2.4 or Apple's Python, but that's less critical. Second Choice: Point folks to: http://pythonmac.org/packages/py25-fat/index.html Hopefully we'll manage to keep that up to date. Oh, and a page or link to a page about how to build for OS-X if someone does want to build their own. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker at noaa.gov From leknarf at pacbell.net Sat Apr 5 00:25:29 2008 From: leknarf at pacbell.net (Scott Frankel) Date: Fri, 4 Apr 2008 15:25:29 -0700 Subject: [Image-SIG] PIL builds for Mac OS X In-Reply-To: <08Apr4.091221pdt."58696"@synergy1.parc.xerox.com> References: <08Apr4.091221pdt."58696"@synergy1.parc.xerox.com> Message-ID: <0061316C-AA11-4524-8319-E048A1E45F8C@pacbell.net> On Apr 4, 2008, at 9:12 AM, Bill Janssen wrote: > This, of course, is on a machine with libpng, libjpeg, libtiff, > freetype, and t1lib pre-installed in ${distdir}. In my experience, > it's finding and/or installing these libraries correctly that's the > issue when building PIL. Locating and installing dependencies was the issue I had when I attempted to build from source. I was pointed to prebuilt binaries and installed those instead. My mail to image-sig (from Oct 23, 2007) follows below. Thanks Scott # ------------------------------------------------------------------------ # I'm attempting to build PIL on a MacOSX box and python setup.py is failing on freetype2. I installed Fink on this machine in order to get freetype2 and the jpeg libraries. My understanding of Fink and its use is only a couple hours old. ;) In PIL's set.py script, I've tried setting the FREETYPE var to explicitly point to the fink lib install. eg: FREETYPE_ROOT = "/sw/lib/" and FREETYPE_ROOT = "/sw/lib/libfreetype.6.dylib" Is this correct? (libfreetype.6.dylib exists at that location and is read/writable.) Fink also installed: /sw/lib/freetype2/lib/ libfreetype.a libfreetype.la Thanks in advance for any suggestions on getting PIL to build properly. Scott PIL v1.1.6 Python v2.4.1 MacOSX v10.4.9 Fink v0.8.1 [ cmd-line ] % python setup.py build_ext -i [ yields ] -------------------------------------------------------------------- PIL 1.1.6 BUILD SUMMARY -------------------------------------------------------------------- version 1.1.6 platform darwin 2.4.1 (#2, Mar 31 2005, 00:05:10) [GCC 3.3 20030304 (Apple Computer, Inc. build 1666)] -------------------------------------------------------------------- --- TKINTER support ok --- JPEG support ok --- ZLIB (PNG/ZIP) support ok *** FREETYPE2 support not available From janssen at parc.com Sat Apr 5 01:04:05 2008 From: janssen at parc.com (Bill Janssen) Date: Fri, 4 Apr 2008 16:04:05 PDT Subject: [Image-SIG] PIL builds for Mac OS X In-Reply-To: <47F6A558.6070107@noaa.gov> References: <47F6A558.6070107@noaa.gov> Message-ID: <08Apr4.160412pdt."58696"@synergy1.parc.xerox.com> > It might be nice to have another one for Python2.4 or Apple's Python, > but that's less critical. As you say, we've discussed this before. I think the #1 priority should be an installer for PIL that works with the system Python, what Chris is calling Apple Python. That's what users have, pre-installed. For Python 2.3.5 (on OS X 10.4), and Python 2.5 (on OS X 10.5). And universal, so that it works on both Intel and PPC. (No, I don't know how to build a "universal" extension.) After that's in place, then an installer for the non-Apple Python distributed from python.org would also be a good thing. As for the rest, let them build from source. Bill From Chris.Barker at noaa.gov Sat Apr 5 01:33:20 2008 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Fri, 04 Apr 2008 16:33:20 -0700 Subject: [Image-SIG] PIL builds for Mac OS X In-Reply-To: <08Apr4.160412pdt.58696@synergy1.parc.xerox.com> References: <47F6A558.6070107@noaa.gov> <08Apr4.160412pdt.58696@synergy1.parc.xerox.com> Message-ID: <47F6BAC0.9060204@noaa.gov> Bill Janssen wrote: > As you say, we've discussed this before. I think the #1 priority > should be an installer for PIL that works with the system Python, what > Chris is calling Apple Python. That's what users have, pre-installed. > For Python 2.3.5 (on OS X 10.4), and Python 2.5 (on OS X 10.5). I beg to differ. Apple's Python2.5 on OS-X 10.5 (Leopard) is the only one that is worth supporting. Early versions simply are not, and we really, really, don't want to encourage anyone to use them -- it's just not that hard to start with a download of an up to date Python. > And universal, so that it works on both Intel and PPC. Which isn't an option with the python Apple delivered with 10.4. In theory, one can support both "MacPython" 2.5 and Apple's Python 2.5 with one installer, which would be the idea situation. > After that's in place, then an installer for the non-Apple Python > distributed from python.org would also be a good thing. I still think this is the first priority -- it works on most OS-X systems, etc. And it's analogous to Windows -- everyone builds Windows binaries for the python.org Python -- it IS the Canonical python build. > As for the rest, let them build from source. Agreed. Fink and macports are their own worlds, like cygwin is. > (No, I don't know how to build a "universal" extension.) It happens by default if you use distutils to build it, but the tricky part is that all the libs you link to need to be universal too. I haven't built PIL in a while -- do you still need to build the core library with a regular old make before building the extension? Or does distutils build the whole thing? If the former, it will take some tweaking to make sure that it's built universal. Fredrik, I guess it's clear why you haven't done this before. Sigh. I'm going to post a note to the pythonmac list to clarify if we can build a single binary for both Apple's 2.5 and MacPython2.5 -- if so, that's the best option. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker at noaa.gov From fredrik at pythonware.com Sat Apr 5 15:40:29 2008 From: fredrik at pythonware.com (Fredrik Lundh) Date: Sat, 05 Apr 2008 15:40:29 +0200 Subject: [Image-SIG] PIL builds for Mac OS X In-Reply-To: <47F6BAC0.9060204@noaa.gov> References: <47F6A558.6070107@noaa.gov> <08Apr4.160412pdt.58696@synergy1.parc.xerox.com> <47F6BAC0.9060204@noaa.gov> Message-ID: Christopher Barker wrote: > I haven't built PIL in a while -- do you still need to build the core > library with a regular old make before building the extension? Or does > distutils build the whole thing? If the former, it will take some > tweaking to make sure that it's built universal. PIL has used a single setup file since 1.1.5. > Fredrik, I guess it's clear why you haven't done this before. Sigh. the lack of Mac OS X boxes in my office part of the problem, I think (guess we're not hip enough ;-) > I'm going to post a note to the pythonmac list to clarify if we can > build a single binary for both Apple's 2.5 and MacPython2.5 -- if so, > that's the best option. sounds great. thanks! From rsenra at acm.org Sat Apr 5 17:43:46 2008 From: rsenra at acm.org (Rodrigo Dias Arruda Senra) Date: Sat, 5 Apr 2008 12:43:46 -0300 Subject: [Image-SIG] im.show does not show, and Tkinter isn't displaying my jpg image In-Reply-To: References: <16074034.post@talk.nabble.com> <200803161015.08245.frederic.mantegazza@gbiloba.org> <200803170745.30937.G.Kloss@massey.ac.nz> Message-ID: <20080405124346.30c68c7d@Neo> [ Fredrik Lundh ]: --------------------- >Guy K. Kloss wrote: > >> I've been thinking already that xv is pretty much a tool of the >> past. I've circumnavigated this problem on my Linux box by >> sym-linking /usr/local/xv to /usr/bin/display (of ImageMagick). >> Maybe it would be more appropriate for "moder times" to replace xv >> with display within PIL for show() on UN*X platforms? > >indeed (and if someone wants to produce a well-tested patch for this, >be my guest). By the way, I'd like to suggest a solution similar to webbrowser in python's stdlib. We could encapsulate in a module tests for the availability of several image viewers, and im.show() could fallback to what was available (or configured) for the current platform. cheers, Rod Senra From fredrik at pythonware.com Sun Apr 6 23:54:08 2008 From: fredrik at pythonware.com (Fredrik Lundh) Date: Sun, 06 Apr 2008 23:54:08 +0200 Subject: [Image-SIG] im.show does not show, and Tkinter isn't displaying my jpg image In-Reply-To: <20080405124346.30c68c7d@Neo> References: <16074034.post@talk.nabble.com> <200803161015.08245.frederic.mantegazza@gbiloba.org> <200803170745.30937.G.Kloss@massey.ac.nz> <20080405124346.30c68c7d@Neo> Message-ID: Rodrigo Dias Arruda Senra wrote: > By the way, I'd like to suggest a solution similar to webbrowser in > python's stdlib. We could encapsulate in a module tests for the > availability of several image viewers, and im.show() could fallback to > what was available (or configured) for the current platform. good idea. I've posted a draft version of such a module here: http://svn.effbot.org/public/stuff/sandbox/pil/ImageShow.py to try it out, just grab the script and run it with an image file as the argument. it takes an image title as an optional second argument. I've briefly tested this on windows and ubuntu; tweaks and feedback for other platforms are welcome. From pellegrini at ill.fr Mon Apr 7 09:14:23 2008 From: pellegrini at ill.fr (pellegrini) Date: Mon, 07 Apr 2008 09:14:23 +0200 Subject: [Image-SIG] lasso Message-ID: <47F9C9CF.4060200@ill.fr> Hello, I am using PIL version 1.1.5. I was wondering if a lasso tool was available when dealing with images in tif format for example. Is there one ? thank you best regards Eric Pellegrini From philippe at fluendo.com Mon Apr 7 10:00:53 2008 From: philippe at fluendo.com (Philippe Normand) Date: Mon, 07 Apr 2008 10:00:53 +0200 Subject: [Image-SIG] PIL cross-compilation Message-ID: <1207555254.21012.3.camel@bling.fluendo.lan> Hi! I'm trying to compile PIL with LTIB (http://www.bitshrine.org) for an ARM-based board. I get this error: gcc -fno-strict-aliasing -DNDEBUG -g -O2 -Wall -Wstrict-prototypes -fPIC -DHAVE_LIBJPEG -DHAVE_LIBZ -I/usr/include/freetype2 -IlibImaging -I/usr/include -I/usr/local/include -I/usr/include/python2.4 -c libImaging/Effects.c -o i686-pc-linux-gnu/temp.linux-i686-2.4/libImaging/Effects.o arm-none-linux-gnueabi-gcc -B /home/phil/mx31/ltib-imx31ads-20071008/rootfs/usr/lib// -idirafter /home/phil/mx31/ltib-imx31ads-20071008/rootfs/usr/include -iwithprefix include -O2 -fsigned-char -msoft-float -fno-strict-aliasing -DNDEBUG -g -O2 -Wall -Wstrict-prototypes -fPIC -DHAVE_LIBJPEG -DHAVE_LIBZ -I/usr/include/freetype2 -IlibImaging -I/usr/include -I/usr/local/include -I/usr/include/python2.4 -c libImaging/Effects.c -o i686-pc-linux-gnu/temp.linux-i686-2.4/libImaging/Effects.o In file included from /usr/include/linux/errno.h:4, from /usr/include/bits/errno.h:25, from /usr/include/errno.h:36, from /usr/include/python2.4/Python.h:38, from libImaging/ImPlatform.h:10, from libImaging/Imaging.h:14, from libImaging/Effects.c:19: /usr/include/asm/errno.h:9:4: warning: #warning This machine appears to be neither x86_64 nor i386. In file included from /usr/include/bits/sigcontext.h:28, from /usr/include/signal.h:333, from /usr/include/python2.4/pyfpe.h:129, from /usr/include/python2.4/Python.h:149, from libImaging/ImPlatform.h:10, from libImaging/Imaging.h:14, from libImaging/Effects.c:19: /usr/include/asm/sigcontext.h:9:4: warning: #warning This machine appears to be neither x86_64 nor i386. In file included from /usr/include/python2.4/pyfpe.h:129, from /usr/include/python2.4/Python.h:149, from libImaging/ImPlatform.h:10, from libImaging/Imaging.h:14, from libImaging/Effects.c:19: /usr/include/signal.h:336: warning: 'struct sigcontext' declared inside parameter list /usr/include/signal.h:336: warning: its scope is only this definition or declaration, which is probably not what you want libImaging/Effects.c:210: warning: 'perlin_init' defined but not used libImaging/Effects.c: In function 'perlin_turbulence': /usr/include/bits/mathinline.h:530: error: impossible constraint in 'asm' /usr/include/bits/mathinline.h:548: error: impossible constraint in 'asm' /usr/include/bits/mathinline.h:530: error: impossible constraint in 'asm' /usr/include/bits/mathinline.h:548: error: impossible constraint in 'asm' Does anybody had a similar issue? Seems related to math library usage. Trying PIL 1.1.6 here. Philippe From rsenra at acm.org Tue Apr 8 04:15:40 2008 From: rsenra at acm.org (Rodrigo Dias Arruda Senra) Date: Mon, 7 Apr 2008 23:15:40 -0300 Subject: [Image-SIG] im.show does not show, and Tkinter isn't displaying my jpg image In-Reply-To: References: <16074034.post@talk.nabble.com> <200803161015.08245.frederic.mantegazza@gbiloba.org> <200803170745.30937.G.Kloss@massey.ac.nz> <20080405124346.30c68c7d@Neo> Message-ID: <20080407231540.053c9537@Neo> [ Fredrik Lundh ]: --------------------- >Rodrigo Dias Arruda Senra wrote: > >> By the way, I'd like to suggest a solution similar to webbrowser in >> python's stdlib. We could encapsulate in a module tests for the >> availability of several image viewers, and im.show() could fallback >> to what was available (or configured) for the current platform. > >good idea. Glad to hear this! > I've posted a draft version of such a module here: > > http://svn.effbot.org/public/stuff/sandbox/pil/ImageShow.py > >to try it out, Just did, and it worked all fine as expected. > tweaks and feedback for other platforms are welcome. I have two small suggestions. Adding "eog" as one of the viewers, and using the environment variable VIEWER as a way to boost the priority of a preferred viewer. A tiny patch follows: =================================================================== --- ImageShow.py (revision 511) +++ ImageShow.py (working copy) @@ -154,6 +154,20 @@ register_if_present(DisplayViewer) + class EogViewer(UnixViewer): + """The Eye of GNOME image viewer is the official image viewer + for the GNOME Desktop environment. With it, you can view + single image files, as well as large image collections. + More info at http://www.gnome.org/projects/eog/ + """ + executable = "eog" + def get_command(self, file, title=None, **options): + command = self.executable + # title - AFAICT, unsupported by eog <=2.18.1 + return command + + register_if_present(EogViewer) + class XVViewer(UnixViewer): executable = "xv" def get_command(self, file, title=None, **options): @@ -167,6 +181,16 @@ register_if_present(XVViewer) +# Boost priority of a viewer if specified in the environment +preferred_viewer = os.environ.get("VIEWER") +if preferred_viewer: + options = [v.executable for v in _viewers] + try: + pos = options.index(preferred_viewer) + _viewers = [_viewers[pos]] + _viewers[:pos] + _viewers[pos+1:] + except ValueError: + pass # preferred viewer not registered, sorry ;o) + if __name__ == "__main__": # usage: python ImageShow.py imagefile [title] print show(Image.open(sys.argv[1]), *sys.argv[2:]) best regards, Rod Senra From G.Kloss at massey.ac.nz Tue Apr 8 05:02:36 2008 From: G.Kloss at massey.ac.nz (Guy K. Kloss) Date: Tue, 8 Apr 2008 15:02:36 +1200 Subject: [Image-SIG] im.show does not show, and Tkinter isn't displaying my jpg image In-Reply-To: <20080407231540.053c9537@Neo> References: <16074034.post@talk.nabble.com> <20080407231540.053c9537@Neo> Message-ID: <200804081502.36372.G.Kloss@massey.ac.nz> On Tue, 08 Apr 2008 2:15:40 pm Rodrigo Dias Arruda Senra wrote: > I have two small suggestions. Adding "eog" as one of the > viewers, and using the environment variable VIEWER as a way > to boost the priority of a preferred viewer. I really like the idea of using $VIEWER, but is it really good/necessary to add each window manager's default viewer here? How about Gwenview then, and the 1001 other viewers for Linux/Wintendo/Mac? Otherwise: Good job, guys! Guy -- Guy K. Kloss Institute of Information and Mathematical Sciences Te Kura Putaiao o Mohiohio me Pangarau Room 2.63, Quad Block A Building Massey University, Auckland, Albany Private Bag 102 904, North Shore Mail Centre voice: +64 9 414-0800 ext. 9585 ? fax: +64 9 441-8181 eMail: G.Kloss at massey.ac.nz ?http://www.massey.ac.nz/~gkloss/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part. Url : http://mail.python.org/pipermail/image-sig/attachments/20080408/f8df7cd8/attachment.pgp From janssen at parc.com Thu Apr 10 00:54:32 2008 From: janssen at parc.com (Bill Janssen) Date: Wed, 9 Apr 2008 15:54:32 PDT Subject: [Image-SIG] PIL builds for Mac OS X In-Reply-To: <47F6BAC0.9060204@noaa.gov> References: <47F6A558.6070107@noaa.gov> <08Apr4.160412pdt.58696@synergy1.parc.xerox.com> <47F6BAC0.9060204@noaa.gov> Message-ID: <08Apr9.155440pdt."58696"@synergy1.parc.xerox.com> > Bill Janssen wrote: > > As you say, we've discussed this before. I think the #1 priority > > should be an installer for PIL that works with the system Python, what > > Chris is calling Apple Python. That's what users have, pre-installed. > > For Python 2.3.5 (on OS X 10.4), and Python 2.5 (on OS X 10.5). > > I beg to differ. Apple's Python2.5 on OS-X 10.5 (Leopard) is the only > one that is worth supporting. Early versions simply are not, and we > really, really, don't want to encourage anyone to use them -- it's just > not that hard to start with a download of an up to date Python. As we've noted, this discussion has gone on before. I seem to be delivering quite a bit of functionality on the Tiger system Python 2.3.5, without issues. Lots of people are. > > And universal, so that it works on both Intel and PPC. > > Which isn't an option with the python Apple delivered with 10.4. Sure it is. Just two packages, one for Intel, and one for PPC, and a preinstall script that selects the right one. > > After that's in place, then an installer for the non-Apple Python > > distributed from python.org would also be a good thing. > > I still think this is the first priority -- it works on most OS-X > systems, etc. And it's analogous to Windows -- everyone builds Windows > binaries for the python.org Python -- it IS the Canonical python build. Yes, it is like Windows -- and that shouldn't be the model. Bill From Chris.Barker at noaa.gov Thu Apr 10 02:11:17 2008 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Wed, 09 Apr 2008 17:11:17 -0700 Subject: [Image-SIG] PIL builds for Mac OS X In-Reply-To: References: <47F6A558.6070107@noaa.gov> <08Apr4.160412pdt.58696@synergy1.parc.xerox.com> <47F6BAC0.9060204@noaa.gov> Message-ID: <47FD5B25.6070603@noaa.gov> Fredrik Lundh wrote: > PIL has used a single setup file since 1.1.5. good, that's easier. > the lack of Mac OS X boxes in my office part of the problem, I think > (guess we're not hip enough ;-) Well, that. But I meant why you didn't just have someone build it for you. Anyway, I'll see what I can do. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker at noaa.gov From Chris.Barker at noaa.gov Thu Apr 10 02:38:14 2008 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Wed, 09 Apr 2008 17:38:14 -0700 Subject: [Image-SIG] PIL builds for Mac OS X In-Reply-To: <08Apr9.155440pdt.58696@synergy1.parc.xerox.com> References: <47F6A558.6070107@noaa.gov> <08Apr4.160412pdt.58696@synergy1.parc.xerox.com> <47F6BAC0.9060204@noaa.gov> <08Apr9.155440pdt.58696@synergy1.parc.xerox.com> Message-ID: <47FD6176.2080206@noaa.gov> Bill Janssen wrote: > As we've noted, this discussion has gone on before. I seem to be > delivering quite a bit of functionality on the Tiger system Python > 2.3.5, without issues. Lots of people are. yes, they are, and also with fink, and MacPython, and macports, etc, etc, etc. There are just way too many versions of python to support on way too many versions of OS-X. > Sure it is. Just two packages, one for Intel, and one for PPC, and a > preinstall script that selects the right one. who's writing that pre-install script? I've NEVER seen one. Ever. Then what happens if someone wants to use py2app, and deliver an app to someone on a different architecture. Sure, you can say: "that's not supported", but if a package like PIL is going to distributing binaries, they should be as widely usable as possible, and I'm betting that Fredrik doesn't want to post 6 versions of PIL 1.6. for OS-X These are all the reasons I advocate MacPython2.5 -- it works on every OS-X from 10.3.* to 10.5, PPC and Intel, and you can build re-distributable apps with it. Anyway, it turns out that you can't build a single binary for MacPython2.5 and Apple's 2.5 -- darn. So I think we're left with two. Over on the pythonmac list Ronald suggested that we really should have build scripts posted for building packages like this, so that others can easily repeat the process. Bill, you posted a nice one here. I'll see if I can alter it to build Universal, and then we'll have a good start. Fredrik, for now, you may as well post the binary here: http://pythonmac.org/packages/py25-fat/dmg/PIL-1.1.6-py2.5-macosx10.4-2007-05-18.dmg Which is for MacPython 2.5 (compatible with the 2.5 you binary you get from python.org) I'll see what I can to get get Bill's script working, and then maybe someone can build one for Apple's python -- I can't, as I don't have OS-X 10.5 -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker at noaa.gov From janssen at parc.com Thu Apr 10 18:30:25 2008 From: janssen at parc.com (Bill Janssen) Date: Thu, 10 Apr 2008 09:30:25 PDT Subject: [Image-SIG] PIL builds for Mac OS X In-Reply-To: <47FD6176.2080206@noaa.gov> References: <47F6A558.6070107@noaa.gov> <08Apr4.160412pdt.58696@synergy1.parc.xerox.com> <47F6BAC0.9060204@noaa.gov> <08Apr9.155440pdt.58696@synergy1.parc.xerox.com> <47FD6176.2080206@noaa.gov> Message-ID: <08Apr10.093032pdt."58696"@synergy1.parc.xerox.com> > > Sure it is. Just two packages, one for Intel, and one for PPC, and a > > preinstall script that selects the right one. > > who's writing that pre-install script? I've NEVER seen one. Ever. Then I'd be willing to take a stab at it, if I had the various (non-flat) installers for the pieces. > ... if a package like PIL is going to distributing binaries, > they should be as widely usable as possible, and I'm betting that > Fredrik doesn't want to post 6 versions of PIL 1.6. for OS-X > > These are all the reasons I advocate MacPython2.5 -- it works on every > OS-X from 10.3.* to 10.5, PPC and Intel, and you can build > re-distributable apps with it. My problem with this approach is that it optimizes for the wrong audience -- it's for the developers, not for the users. The users really want to just install some package and get on with it -- they don't want to first pre-customize their machine for the developer's convenience by downloading MacPython and installing it. Yep, thanks to various factors, Fredrik needs a big installer for OS X, but I'm not convinced it's not doable as a single download. Bill From frederic.mantegazza at gbiloba.org Fri Apr 11 08:01:32 2008 From: frederic.mantegazza at gbiloba.org (=?iso-8859-15?q?Fr=E9d=E9ric_Mantegazza?=) Date: Fri, 11 Apr 2008 07:01:32 +0100 Subject: [Image-SIG] Embedded ICC profiles - updated JPEG patch In-Reply-To: <47C1637B.9070708@hoech.org> References: <47BF650C.5010103@hoech.org> <47C1637B.9070708@hoech.org> Message-ID: <200804110801.32947.frederic.mantegazza@gbiloba.org> On dimanche 24 f?vrier 2008, Florian H?ch wrote: > Just noticed that the JPEG patch I suggested would not succeed in > retrieving ICC profiles larger than 64K, because these would be split > across multiple APP2 markers. New code: Could you provide a complete patch against the current 1.1.6 version? BTW, are there plans for a new release of PIL? Or is there a svn version available somewhere? Thanks, -- Fr?d?ric http://www.gbiloba.org From rsenra at acm.org Sat Apr 12 06:25:41 2008 From: rsenra at acm.org (Rodrigo Dias Arruda Senra) Date: Sat, 12 Apr 2008 01:25:41 -0300 Subject: [Image-SIG] im.show does not show, and Tkinter isn't displaying my jpg image In-Reply-To: <200804081502.36372.G.Kloss@massey.ac.nz> References: <16074034.post@talk.nabble.com> <20080407231540.053c9537@Neo> <200804081502.36372.G.Kloss@massey.ac.nz> Message-ID: <20080412012541.2a7a9dc8@Neo> [ Guy K. Kloss ]: --------------------- >On Tue, 08 Apr 2008 2:15:40 pm Rodrigo Dias Arruda Senra wrote: >> I have two small suggestions. Adding "eog" as one of the >> viewers, and using the environment variable VIEWER as a way >> to boost the priority of a preferred viewer. > >I really like the idea of using $VIEWER, Glad to know. > but is it really good/necessary to add each window manager's default > viewer here? Not necessary, but it is certainly good to find out that your favorite image viewer is supported. And if it takes 4 or 5 lines of code to achieve it I say it is worth it. > How about Gwenview then, Sure, why not. I think Gnome and KDE default viewers should be by all means supported. > and the 1001 other viewers for Linux/Wintendo/Mac? I guess 1001 would be too much ;o). But a dozen should cover enough tribes and wild preferences. cheers, Rod Senra From rsenra at acm.org Sat Apr 12 06:31:28 2008 From: rsenra at acm.org (Rodrigo Dias Arruda Senra) Date: Sat, 12 Apr 2008 01:31:28 -0300 Subject: [Image-SIG] PIL builds for Mac OS X In-Reply-To: <47FD6176.2080206@noaa.gov> References: <47F6A558.6070107@noaa.gov> <08Apr4.160412pdt.58696@synergy1.parc.xerox.com> <47F6BAC0.9060204@noaa.gov> <08Apr9.155440pdt.58696@synergy1.parc.xerox.com> <47FD6176.2080206@noaa.gov> Message-ID: <20080412013128.3f0f409e@Neo> [ Christopher Barker ]: --------------------- >Fredrik, for now, you may as well post the binary here: > >http://pythonmac.org/packages/py25-fat/dmg/PIL-1.1.6-py2.5-macosx10.4-2007-05-18.dmg > > >Which is for MacPython 2.5 (compatible with the 2.5 you binary you get >from python.org) > >I'll see what I can to get get Bill's script working, and then maybe >someone can build one for Apple's python -- I can't, as I don't have >OS-X 10.5 Hi Christopher, I have just tried out your package on a PowerPC running OSX 10.5 (Leopard) and it worked just fine (although not extensively tested). cheers Rod Senra From fredrik at pythonware.com Sat Apr 12 13:35:54 2008 From: fredrik at pythonware.com (Fredrik Lundh) Date: Sat, 12 Apr 2008 13:35:54 +0200 Subject: [Image-SIG] PIL builds for Mac OS X In-Reply-To: <20080412013128.3f0f409e@Neo> References: <47F6A558.6070107@noaa.gov> <08Apr4.160412pdt.58696@synergy1.parc.xerox.com> <47F6BAC0.9060204@noaa.gov> <08Apr9.155440pdt.58696@synergy1.parc.xerox.com> <47FD6176.2080206@noaa.gov> <20080412013128.3f0f409e@Neo> Message-ID: Rodrigo Dias Arruda Senra wrote: >> http://pythonmac.org/packages/py25-fat/dmg/PIL-1.1.6-py2.5-macosx10.4-2007-05-18.dmg > I have just tried out your package on a PowerPC running OSX 10.5 > (Leopard) and it worked just fine (although not extensively tested). with a standard Apple Python install, the python.org distribution, or some other version? (is MacPython the same thing as the python.org version, btw? the more I learn about Python on Mac OS X, the more confused I get ;-) From lists+Image_SIG at hoech.org Sat Apr 12 18:00:50 2008 From: lists+Image_SIG at hoech.org (=?ISO-8859-15?Q?Florian_H=F6ch?=) Date: Sat, 12 Apr 2008 18:00:50 +0200 Subject: [Image-SIG] Embedded ICC profiles - patches for JPEG, PNG, PSD, TIFF (PIL 1.1.6) In-Reply-To: <200804110801.32947.frederic.mantegazza@gbiloba.org> References: <47BF650C.5010103@hoech.org> <47C1637B.9070708@hoech.org> <200804110801.32947.frederic.mantegazza@gbiloba.org> Message-ID: <4800DCB2.1080907@hoech.org> Hello Fr?d?ric, here are the patches: --- JpegImagePlugin.py.bak Sat Feb 23 01:48:22 2008 +++ JpegImagePlugin.py Sat Mar 08 07:39:58 2008 @@ -81,6 +81,28 @@ elif marker == 0xFFE2 and s[:5] == "FPXR\0": # extract FlashPix information (incomplete) self.info["flashpix"] = s # FIXME: value will change + elif marker == 0xFFE2 and s[:12] == "ICC_PROFILE\0": + # Since an ICC profile can be larger than the maximum size of + # a JPEG marker (64K), we need provisions to split it into + # multiple markers. The format defined by the ICC specifies + # one or more APP2 markers containing the following data: + # Identifying string ASCII "ICC_PROFILE\0" (12 bytes) + # Marker sequence number 1, 2, etc (1 byte) + # Number of markers Total of APP2's used (1 byte) + # Profile data (remainder of APP2 data) + # Decoders should use the marker sequence numbers to + # reassemble the profile, rather than assuming that the APP2 + # markers appear in the correct sequence. + if not self.info.has_key("icc_profile"): + self.icc_profile_marker_prev = "\0" + self.info["icc_profile"] = "" + icc_profile_marker_curr = s[12] + if self.icc_profile_marker_prev < icc_profile_marker_curr: + self.info["icc_profile"] += s[14:] + else: + self.info["icc_profile"] = s[14:] + \ + self.info["icc_profile"] + self.icc_profile_marker_prev = icc_profile_marker_curr elif marker == 0xFFEE and s[:5] == "Adobe": self.info["adobe"] = i16(s, 5) # extract Adobe custom properties --- PngImagePlugin.py.bak Sat Feb 23 01:10:49 2008 +++ PngImagePlugin.py Sat Feb 23 02:18:38 2008 @@ -32,7 +32,7 @@ import re, string import Image, ImageFile, ImagePalette - +import zlib def i16(c): return ord(c[1]) + (ord(c[0])<<8) @@ -174,6 +174,19 @@ self.im_mode = None self.im_tile = None self.im_palette = None + + def chunk_iCCP(self, pos, len): + + # ICC profile + s = ImageFile._safe_read(self.fp, len) + # according to PNG spec, the iCCP chunk contains: + # Profile name 1-79 bytes (character string) + # Null separator 1 byte (null character) + # Compression method 1 byte (0) + # Compressed profile n bytes (zlib with deflate compression) + i = string.find(s, chr(0)) + self.im_info["icc_profile"] = zlib.decompress(s[i+2:]) + return s def chunk_IHDR(self, pos, len): --- PsdImagePlugin.py.bak Sat Jun 03 11:58:20 2006 +++ PsdImagePlugin.py Sat Feb 23 21:10:48 2008 @@ -108,6 +108,8 @@ if (len(data) & 1): read(1) # padding self.resources.append((id, name, data)) + if id == 1039: # ICC profile + self.info["icc_profile"] = data # # layer and mask information --- TiffImagePlugin.py.bak Sat Apr 12 17:50:29 2008 +++ TiffImagePlugin.py Sat Feb 23 02:06:57 2008 @@ -102,6 +102,7 @@ COPYRIGHT = 33432 IPTC_NAA_CHUNK = 33723 # newsphoto properties PHOTOSHOP_CHUNK = 34377 # photoshop properties +ICCPROFILE = 34675 COMPRESSION_INFO = { # Compression => pil compression name @@ -515,6 +516,9 @@ if self.tag.has_key(317): # Section 14: Differencing Predictor self.decoderconfig = (self.tag[PREDICTOR][0],) + + if self.tag.has_key(ICCPROFILE): + self.info['icc_profile'] = self.tag[ICCPROFILE] return args Regards, Florian Fr?d?ric Mantegazza schrieb: > Could you provide a complete patch against the current 1.1.6 version? From rsenra at acm.org Sun Apr 13 02:05:25 2008 From: rsenra at acm.org (Rodrigo Dias Arruda Senra) Date: Sat, 12 Apr 2008 21:05:25 -0300 Subject: [Image-SIG] PIL builds for Mac OS X In-Reply-To: References: <47F6A558.6070107@noaa.gov> <08Apr4.160412pdt.58696@synergy1.parc.xerox.com> <47F6BAC0.9060204@noaa.gov> <08Apr9.155440pdt.58696@synergy1.parc.xerox.com> <47FD6176.2080206@noaa.gov> <20080412013128.3f0f409e@Neo> Message-ID: <20080412210525.7cf0c635@Neo> [ Rodrigo Senra ]: ------------------ >>> http://pythonmac.org/packages/py25-fat/dmg/PIL-1.1.6-py2.5-macosx10.4-2007-05-18.dmg > >> I have just tried out your package on a PowerPC running OSX 10.5 >> (Leopard) and it worked just fine (although not extensively tested). [ Fredrik Lundh ]: --------------------- >with a standard Apple Python install, the python.org distribution, or >some other version? I am running the standard Apple Python install. $ python Python 2.5.2 (r252:60911, Feb 22 2008, 07:57:53) [GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import Image >>> Image.VERSION '1.1.6' >>> import sys >>> sys.path ['', '/Library/Frameworks/Python.framework/Versions/2.5/lib/python25.zip', '/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5', '/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-darwin', '/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-mac', '/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-mac/lib-scriptpackages', '/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-tk', '/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-dynload', '/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages', '/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/PIL'] >>> >(is MacPython the same thing as the python.org version, btw? I *guess* it is python.org's classic compiled with --enable-framework and package as a .dmg install file. I know for a fact that you can also install it from the sources in Mac OSX and compile it without --enable-framework, in this case, it will be installed in the standard /usr/local/src (supposing no --prefix override). I found some pros/cons explanations here [1]. > the more I learn about Python on Mac OS X, the more confused I > get ;-) By all means, welcome to the club. ;o) cheers, Rod Senra [1] http://svn.pythonmac.org/python24/python24-fat/Mac/OSX/README From stevecole at fastmail.fm Sun Apr 13 07:28:17 2008 From: stevecole at fastmail.fm (Steve Cole) Date: Sun, 13 Apr 2008 00:28:17 -0500 Subject: [Image-SIG] YhzDg Message-ID: <01F053D0-26FF-458C-8A46-BE9FEBF44359@fastmail.fm> From haase at msg.ucsf.edu Mon Apr 14 11:27:33 2008 From: haase at msg.ucsf.edu (Sebastian Haase) Date: Mon, 14 Apr 2008 11:27:33 +0200 Subject: [Image-SIG] why does Image.open fail after reload(Image) -- fixable bug ?? Message-ID: Hi, this is a short question: Why does Image.open fail after reload(Image) ? Here is what I get : {{{ >>> import Image >>> i = Image.open(r"/Users/labuser/Desktop/Picture 5.png") >>> i.size (1920, 1200) >>> reload(Image) >>> i = Image.open("Picture 5.png") Traceback (most recent call last): File "", line 1, in File "......./PIL/Image.py", line 1916, in open raise IOError("cannot identify image file") IOError: cannot identify image file >>> Image.VERSION '1.1.6' }}} Since I ran into this a couple times, I was just wondering if this could be fixed ? Thanks for PIL, Sebastian Haase From haase at msg.ucsf.edu Mon Apr 14 11:40:32 2008 From: haase at msg.ucsf.edu (Sebastian Haase) Date: Mon, 14 Apr 2008 11:40:32 +0200 Subject: [Image-SIG] help me to contribute -- writing multi-page TIFF .... Message-ID: Hi, Since TIFF seems to be the most wanted format in our group (microscopy images) I now want to add write support for multi-page tiff image. I was wondering if people here could give me some hints and / or references on how to go about this ? Of course if someone knows about existing code to write multi-page tiff in Python -- please speak up now ;-) (( wxPython maybe ?)) Since multi-page tiffs, called image-sequences in PIL, can be read by PIL I thought, it should be quite informative to set Image.DEBUG = 1 and open some simple tif sequence file. Right ? Is it important if the "Image File Directory" (IFD) is in front or after each page !? Is a multi-page tif just a sequence of "normal" (i.e. single page) tiff IFD-imageData-pairs with an adjusted IFD entry for "next IFD" !? Thanks, Sebastian Haase From haase at msg.ucsf.edu Mon Apr 14 12:06:53 2008 From: haase at msg.ucsf.edu (Sebastian Haase) Date: Mon, 14 Apr 2008 12:06:53 +0200 Subject: [Image-SIG] why does Image.open fail after reload(Image) -- fixable bug ?? In-Reply-To: References: Message-ID: On Mon, Apr 14, 2008 at 11:27 AM, Sebastian Haase wrote: > Hi, > > this is a short question: > > Why does Image.open fail after reload(Image) ? > > Here is what I get : > {{{ > >>> import Image > >>> i = Image.open(r"/Users/labuser/Desktop/Picture 5.png") > >>> i.size > (1920, 1200) > >>> reload(Image) > > >>> i = Image.open("Picture 5.png") > Traceback (most recent call last): > File "", line 1, in > File "......./PIL/Image.py", line 1916, in open > raise IOError("cannot identify image file") > IOError: cannot identify image file > >>> Image.VERSION > '1.1.6' > }}} > > Since I ran into this a couple times, > I was just wondering if this could be fixed ? > > Thanks for PIL, > Sebastian Haase > It appears that in Image.py there are two functions named preinit() and init(). While preinit() seems harmless , I found that init() calls __import__(f, globals(), locals(), []) with f being every files found ending in "ImagePlugin.py" (without the '.py') I guess that these calls are supposed to fill in the dictionaries OPEN, SAVE and ID (and more). But __import__ does nothing when called the second time for a given file (import is no reload). So they stay empty. Any idea ho to fix this ? How about changing these lines _initialized = 0 ID = [] OPEN = {} MIME = {} SAVE = {} EXTENSION = {} into try: _initialied # check if we are imported and not reloaded except: _initialized = 0 ID = [] OPEN = {} MIME = {} SAVE = {} EXTENSION = {} Cheers, Sebastian Haase From waldemar.osuch at gmail.com Mon Apr 14 19:17:42 2008 From: waldemar.osuch at gmail.com (Waldemar Osuch) Date: Mon, 14 Apr 2008 11:17:42 -0600 Subject: [Image-SIG] help me to contribute -- writing multi-page TIFF .... In-Reply-To: References: Message-ID: <6fae95540804141017o2c7eb63fk28ee4ac1b82f25d2@mail.gmail.com> On Mon, Apr 14, 2008 at 3:40 AM, Sebastian Haase wrote: > Hi, > Since TIFF seems to be the most wanted format in our group (microscopy > images) I now want to add write support for multi-page tiff image. > > I was wondering if people here could give me some hints and / or > references on how to go about this ? > > Of course if someone knows about existing code to write multi-page > tiff in Python -- please speak up now ;-) (( wxPython maybe ?)) I have used http://www.haynold.com/software_projects/2004/pytiff/ before. The project seems to abandoned but it worked very nicely for my simple needs. Another option worth considering is to use something like: http://www.libtiff.org/ in combination with subprocess module. > > Since multi-page tiffs, called image-sequences in PIL, can be read by > PIL I thought, it should be quite informative to set > Image.DEBUG = 1 > and open some simple tif sequence file. Right ? > > Is it important if the "Image File Directory" (IFD) is in front or > after each page !? > Is a multi-page tif just a sequence of "normal" (i.e. single page) > tiff IFD-imageData-pairs with an adjusted IFD entry for "next IFD" !? > > > Thanks, > Sebastian Haase > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > From haase at msg.ucsf.edu Mon Apr 14 22:13:41 2008 From: haase at msg.ucsf.edu (Sebastian Haase) Date: Mon, 14 Apr 2008 22:13:41 +0200 Subject: [Image-SIG] why does Image.open fail after reload(Image) -- fixable bug ?? In-Reply-To: References: <4803AFF1.10506@famillepinault.fr> Message-ID: On Mon, Apr 14, 2008 at 9:26 PM, Nicolas Pinault wrote: > > > > Hi, > > > > this is a short question: > > > > Why does Image.open fail after reload(Image) ? > > > > > Why do you need to reload Image package ? > > Nicolas I have a "reloadAll" function -- and then it's always quite annoying if I have to "reboot" Python ;-) Also I think the when I want to add new things to PIL itself, a reload would be very convenient !! -Sebastian From steve at holdenweb.com Mon Apr 14 23:07:07 2008 From: steve at holdenweb.com (Steve Holden) Date: Mon, 14 Apr 2008 17:07:07 -0400 Subject: [Image-SIG] why does Image.open fail after reload(Image) -- fixable bug ?? In-Reply-To: References: <4803AFF1.10506@famillepinault.fr> Message-ID: <4803C77B.4020705@holdenweb.com> Sebastian Haase wrote: > On Mon, Apr 14, 2008 at 9:26 PM, Nicolas Pinault > wrote: >> >>> Hi, >>> >>> this is a short question: >>> >>> Why does Image.open fail after reload(Image) ? >>> >>> >> Why do you need to reload Image package ? >> >> Nicolas > > I have a "reloadAll" function -- and then it's always quite annoying > if I have to "reboot" Python ;-) > Also I think the when I want to add new things to PIL itself, a reload > would be very convenient !! > Indeed it would, but unless I am out of date there is no mechanism to reload extension (compiled) modules, so _imaging would have to stay there once loaded. regards Steve -- Steve Holden +1 571 484 6266 +1 800 494 3119 Holden Web LLC http://www.holdenweb.com/ From haase at msg.ucsf.edu Mon Apr 14 23:30:03 2008 From: haase at msg.ucsf.edu (Sebastian Haase) Date: Mon, 14 Apr 2008 23:30:03 +0200 Subject: [Image-SIG] why does Image.open fail after reload(Image) -- fixable bug ?? In-Reply-To: <4803C77B.4020705@holdenweb.com> References: <4803AFF1.10506@famillepinault.fr> <4803C77B.4020705@holdenweb.com> Message-ID: On Mon, Apr 14, 2008 at 11:07 PM, Steve Holden wrote: > > Sebastian Haase wrote: > > > On Mon, Apr 14, 2008 at 9:26 PM, Nicolas Pinault > > wrote: > > > > > > > > > > > > Hi, > > > > > > > > this is a short question: > > > > > > > > Why does Image.open fail after reload(Image) ? > > > > > > > > > > > > > > > Why do you need to reload Image package ? > > > > > > Nicolas > > > > > > > I have a "reloadAll" function -- and then it's always quite annoying > > if I have to "reboot" Python ;-) > > Also I think the when I want to add new things to PIL itself, a reload > > would be very convenient !! > > > > > Indeed it would, but unless I am out of date there is no mechanism to > reload extension (compiled) modules, so _imaging would have to stay there > once loaded. > Yes, of course. But there is *a lot* of Python code that might be worth reloading. And in any case even IF you were to do a reload(_imaging) (without the intended result, of course) it would not cause _imaging to fail from then on. But again, all I'm asking for is that PIL should not fail after a reload. In fact, I just found that, e.g. reload(TiffImagePlugin) works. It's just that a reload(Image) is fatal. I think that Image.py contains some "not so clean magic", that might be worth thinking about. I'm talking about changing sys.path (and undoing that change afterwards) -Sebastian From haase at msg.ucsf.edu Tue Apr 15 16:35:49 2008 From: haase at msg.ucsf.edu (Sebastian Haase) Date: Tue, 15 Apr 2008 16:35:49 +0200 Subject: [Image-SIG] patch -- was: help me to contribute -- writing multi-page TIFF .... Message-ID: On Mon, Apr 14, 2008 at 7:17 PM, Waldemar Osuch wrote: > On Mon, Apr 14, 2008 at 3:40 AM, Sebastian Haase wrote: > > Hi, > > Since TIFF seems to be the most wanted format in our group (microscopy > > images) I now want to add write support for multi-page tiff image. > > > > I was wondering if people here could give me some hints and / or > > references on how to go about this ? > > > > Of course if someone knows about existing code to write multi-page > > tiff in Python -- please speak up now ;-) (( wxPython maybe ?)) > > I have used http://www.haynold.com/software_projects/2004/pytiff/ before. > The project seems to abandoned but it worked very nicely for my simple needs. > > Another option worth considering is to use something like: > http://www.libtiff.org/ in combination with subprocess module. > Hi all, I'm happy to submit a patch. It works for me. It modifies TiffImagePlugin.py so that I can use another (external) function to write multi page TIFF files. The reason I need an extra function is that I did not see how PIL is *supposed to* handle multi-page aka. animation Images. As far as I could tell, an Image class object is always only a "2D" image; loading of multi-page (or animation) images is only supported via the ImageFile class and its seek function. My "external" save function is special to my own environment, but should be easily adjustable. It safes higher dimensional numpy arrays and makes use of my own array2image() function: {{{ def saveTiffMultipage(arr, fn, rescaleTo8bit=False, **params): if arr.ndim == 4: if arr.shape[1] not in (2,3,4): raise ValueError, "can save 4d arrays (color) only with second dim of len 2..4 (RG[B[A]])" elif arr.ndim != 3: raise ValueError, "can only save 3d (grey) or 4d (color) arrays" fp = open(fn, 'w+b') ifd_offsets=[] if rescaleTo8bit: mi,ma = float(arr.min()), float(arr.max()) ra = ma-mi params["_debug_multipage"] = True for z in range(arr.shape[0]): if rescaleTo8bit: a=(arr[z]-mi)*255./ra ii = array2image(a.astype(N.uint8)) else: ii = array2image(arr[z]) fp.seek(0,2) # go to end of file if z==0: # ref. PIL TiffImagePlugin # PIL always starts the first IFD at offset 8 ifdOffset = 8 else: ifdOffset = fp.tell() ii.save(fp, format="TIFF", **params) if z>0: # correct "next" entry of previous ifd -- connect ! ifdo = ifd_offsets[-1] fp.seek(ifdo) ifdLength = ii._debug_multipage.i16(fp.read(2)) fp.seek(ifdLength*12,1) # go to "next" field near end of ifd fp.write(ii._debug_multipage.o32( ifdOffset )) ifd_offsets.append(ifdOffset) fp.close() }}} Attached is the needed patch for TiffImagePlugin.py. It is against the version I got from svn yesterday. My version also contains someone else's patch for big-/little-endian byte order handling. Regards, Sebastian Haase PS: What is actually the process that patches might get into the official PIL code ? is there a plan for a 1.1.7 version ? -------------- next part -------------- A non-text attachment was scrubbed... Name: tiff.multipage.patch Type: application/octet-stream Size: 11724 bytes Desc: not available Url : http://mail.python.org/pipermail/image-sig/attachments/20080415/6bd31b98/attachment.obj From Chris.Barker at noaa.gov Wed Apr 16 07:09:16 2008 From: Chris.Barker at noaa.gov (Chris.Barker) Date: Tue, 15 Apr 2008 22:09:16 -0700 Subject: [Image-SIG] PIL builds for Mac OS X In-Reply-To: <20080412210525.7cf0c635@Neo> References: <47F6A558.6070107@noaa.gov> <08Apr4.160412pdt.58696@synergy1.parc.xerox.com> <47F6BAC0.9060204@noaa.gov> <08Apr9.155440pdt.58696@synergy1.parc.xerox.com> <47FD6176.2080206@noaa.gov> <20080412013128.3f0f409e@Neo> <20080412210525.7cf0c635@Neo> Message-ID: <480589FC.2050309@noaa.gov> Rodrigo Dias Arruda Senra wrote: >> with a standard Apple Python install, the python.org distribution, or >> some other version? >> > > I am running the standard Apple Python install. > > Are you sure? I thought Apple put theirs in /System/Library, rather than /Library. Also, I'm pretty sure the Apple one is 2.5.1, not 2.5.2 >> (is MacPython the same thing as the python.org version, btw? >> > > yes. >> the more I learn about Python on Mac OS X, the more confused I >> get ;-) yes, it quite painful. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker at noaa.gov From rsenra at acm.org Wed Apr 16 18:06:28 2008 From: rsenra at acm.org (Rodrigo Dias Arruda Senra) Date: Wed, 16 Apr 2008 13:06:28 -0300 Subject: [Image-SIG] PIL builds for Mac OS X In-Reply-To: <480589FC.2050309@noaa.gov> References: <47F6A558.6070107@noaa.gov> <08Apr4.160412pdt.58696@synergy1.parc.xerox.com> <47F6BAC0.9060204@noaa.gov> <08Apr9.155440pdt.58696@synergy1.parc.xerox.com> <47FD6176.2080206@noaa.gov> <20080412013128.3f0f409e@Neo> <20080412210525.7cf0c635@Neo> <480589FC.2050309@noaa.gov> Message-ID: <20080416130628.254dbaf2@Neo> [ Chris.Barker ]: --------------------- >Rodrigo Dias Arruda Senra wrote: >>> with a standard Apple Python install, the python.org distribution, >>> or some other version? >>> >> >> I am running the standard Apple Python install. >> >> >Are you sure? No, I am not. That is why I put the full path in my response, expecting that someone could figure out if that was the standard Apple's version or python.org's. > I thought Apple put theirs in /System/Library, rather >than /Library. Also, I'm pretty sure the Apple one is 2.5.1, not 2.5.2 Thank you, I do believe you. I probably upgraded it and forgot about it ;o) cheers, Rod Senra From contact at pythonxy.com Thu Apr 10 10:44:57 2008 From: contact at pythonxy.com (Python(x,y) - Python for Scientists) Date: Thu, 10 Apr 2008 10:44:57 +0200 (CEST) Subject: [Image-SIG] Python(x,y) - Python for Scientists Message-ID: <54996.132.165.76.2.1207817097.squirrel@secure.nuxit.net> Dear all, The scientists among you may be interested in Python(x,y), a new scientific-oriented Python distribution. This Python/Eclipse distribution is freely available as a one-click Windows installer (a release for GNU/Linux with similar features will follow soon): http://www.pythonxy.com Please do not hesitate to forward this announcement... (I am very sorry if you have already received this e-mail through "python-list" mailing list) Thanks a lots, PR -- P. Raybaut Python(x,y) http://www.pythonxy.com From daniel_kahn at ssaihq.com Thu Apr 17 18:37:13 2008 From: daniel_kahn at ssaihq.com (Daniel Kahn) Date: Thu, 17 Apr 2008 12:37:13 -0400 Subject: [Image-SIG] Seg Fault using PIL, Palette problem? Message-ID: <48077CB9.5060806@ssaihq.com> Greetings, I have a program which is producing a segmentation fault. I will attach the source code to reproduce the problem. The code is from a larger program which I have paired down considerably to help isolate the problem. The stack trace from GDB is below. The crash occured in a PIL function, relating to Palette destruction. I am running under CentOS (which is supposed to be identical to Red Hat, as I understand). Here is the python information (however the crash has occured on 2.3.4 and 2.5.1 as well). $ ~/bin/python Python 2.5.2 (r252:60911, Apr 15 2008, 17:53:34) [GCC 3.4.6 20060404 (Red Hat 3.4.6-9)] on linux2 I am using PIL 1.1.6. The code requires an image to work. I have used the image lena.gif which I have not included here, but is widely available on the web. I expect the problem will occur with any image. The first line (#!/home/dkahn/bin/python) directs program to use the version of python I installed in my home directory. You will need to change this to get the correct one for you system. Thanks for any help in fixing this problem. Cheers, --dan Backtrace: (gdb) where #0 0x009c28f9 in free () from /lib/tls/libc.so.6 #1 0x005e6f49 in ImagingPaletteDelete (palette=0x85234d0) at libImaging/Palette.c:126 #2 0x005ed8fd in ImagingDelete (im=0x84aec78) at libImaging/Storage.c:243 #3 0x005cbe33 in _dealloc (imagep=0xb7f570f0) at _imaging.c:201 #4 0x08082ebc in dict_dealloc (mp=0xff) at Objects/dictobject.c:851 #5 0x080612c9 in instance_dealloc (inst=0xb7f9034c) at Objects/classobject.c:660 #6 0x081093ea in frame_dealloc (f=0x84a6de4) at Objects/frameobject.c:416 #7 0x080c40a9 in PyEval_EvalCodeEx (co=0xb7f5d608, globals=0xb7faeacc, locals=0x0, args=0xb7f6bcd8, argcount=1, kws=0x0, kwcount=0, defs=0xb7f6c1a0, defcount=4, closure=0x0) at Python/ceval.c:2847 #8 0x0810ae36 in function_call (func=0xb7f1509c, arg=0xb7f6bccc, kw=0x0) at Objects/funcobject.c:517 #9 0x0805d958 in PyObject_Call (func=0xf7, arg=0xb7f6bccc, kw=0x0) at Objects/abstract.c:1861 #10 0x0806696d in instancemethod_call (func=0xb7f551bc, arg=0xb7f6bccc, kw=0x0) at Objects/classobject.c:2519 #11 0x0805d958 in PyObject_Call (func=0xf7, arg=0xb7f9602c, kw=0x0) at Objects/abstract.c:1861 #12 0x080bce13 in PyEval_CallObjectWithKeywords (func=0xb7f551bc, arg=0xb7f9602c, kw=0x0) at Python/ceval.c:3442 #13 0x08060dbc in PyInstance_New (klass=0xb7f60f5c, arg=0xb7f9602c, kw=0x0) at Objects/classobject.c:560 #14 0x0805d958 in PyObject_Call (func=0xf7, arg=0xb7f9602c, kw=0x0) at Objects/abstract.c:1861 #15 0x080bf564 in PyEval_EvalFrameEx (f=0x847b01c, throwflag=0) at Python/ceval.c:3784 #16 0x080c411b in PyEval_EvalCodeEx (co=0xb7f5db18, globals=0xb7faeacc, locals=0xb7faeacc, args=0x0, argcount=0, kws=0x0, kwcount=0, defs=0x0, defcount=0, closure=0x0) at Python/ceval.c:2836 #17 0x080c426a in PyEval_EvalCode (co=0xb7f5db18, globals=0xb7faeacc, locals=0xb7faeacc) at Python/ceval.c:494 #18 0x080e2a8d in PyRun_FileExFlags (fp=0x8469008, filename=0xbff8b407 "CreateSampleTable.py", start=257, globals=0xb7faeacc, locals=0xb7faeacc, closeit=1, flags=0xbff161cc) at Python/pythonrun.c:1273 #19 0x080e3712 in PyRun_SimpleFileExFlags (fp=0x8469008, filename=0xbff8b407 "CreateSampleTable.py", closeit=1, flags=0xbff161cc) at Python/pythonrun.c:879 #20 0x08056d59 in Py_Main (argc=1, argv=0xbff16304) at Modules/main.c:523 #21 0x080562f7 in main (argc=2, argv=0xbff16304) at ./Modules/python.c:23 -- Daniel Kahn Science Systems and Applications Inc. 301-867-2162 -------------- next part -------------- A non-text attachment was scrubbed... Name: CreateSampleTable.py Type: application/x-python Size: 1080 bytes Desc: not available Url : http://mail.python.org/pipermail/image-sig/attachments/20080417/7881659f/attachment.bin From gandalf at shopzeus.com Mon Apr 21 17:40:07 2008 From: gandalf at shopzeus.com (Laszlo Nagy) Date: Mon, 21 Apr 2008 17:40:07 +0200 Subject: [Image-SIG] PIL and truetype font encoding Message-ID: <480CB557.4070300@shopzeus.com> def getfnt(size): return ImageFont.truetype("cartoon.ttf",size,encoding='unic') Using the above function, I cannot draw special german characters. E.g. u'L\xfctgendorf' It will print "Lutgendorf" instead of "L?tgendorf". Much more interesting is that I can also do this: def getfnt(size): return ImageFont.truetype("cartoon.ttf",size,encoding='put_somethin_here_it_has_no_effect WHAT?????? ') Same result. Shouldn't the truetype constructor raise an exception if the encoding is invalid and/or not available with the selected font? BTW my "cartoon.ttf" font is able to handle "L?tgendorf" - I have tested it from GIMP. It can handle ? ? ? and other non-ascii characters. So I'm 100% sure that the problem is either with PIL and/or my program, not the truetype font. System info: Linux saturnus 2.6.22-14-generic #1 SMP Tue Feb 12 07:42:25 UTC 2008 i686 GNU/Linux Python 2.5.1 (r251:54863, Mar 7 2008, 04:10:12) [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2 PIL was installed with apt-get: python-imaging 1.1.6-1 I can send the truetype font file if needed (AFAIK it is not copyrighted.) Thank you, Laszlo From fredrik at pythonware.com Mon Apr 21 19:37:35 2008 From: fredrik at pythonware.com (Fredrik Lundh) Date: Mon, 21 Apr 2008 19:37:35 +0200 Subject: [Image-SIG] PIL and truetype font encoding In-Reply-To: <480CB557.4070300@shopzeus.com> References: <480CB557.4070300@shopzeus.com> Message-ID: Laszlo Nagy wrote: > It will print "Lutgendorf" instead of "L?tgendorf". Much more interesting > is that I can also do this: > > def getfnt(size): > return ImageFont.truetype("cartoon.ttf",size,encoding='put_somethin_here_it_has_no_effect WHAT?????? ') > > Same result. Shouldn't the truetype constructor raise an exception if the > encoding is invalid and/or not available with the selected font? The current driver ignores the encoding if it isn't exactly four characters long. Otherwise, it'll raise an error if the underlying library (FreeType) reports an error. No idea why L?tgendorf comes out wrong; I'm using Unicode fonts in deployed applications without any problems. Feel free to mail me a short test snippet and a copy of the font, and I'll take a look when I find the time. cheers /F From robert.parker at anu.edu.au Tue Apr 22 04:23:29 2008 From: robert.parker at anu.edu.au (robert.parker at anu.edu.au) Date: Tue, 22 Apr 2008 12:23:29 +1000 (EST) Subject: [Image-SIG] Reading and writing AVI files using PIL Message-ID: <1244.202.161.0.92.1208831009.squirrel@mail.rsbs.anu.edu.au> I've been having compatibility problems reading avi files on various platforms and decided it would be nice to have a "pure" python reader. After looking through the image-sig PIL archives (back to May 2005) the only candidates I found were pymedia by Fabrice Bellard and pyvideo by Riccardo Trocca. While both are more advanced than my final result, neither fill the pure python requirment. My attempts can be found at: http://members.iinet.net.au/~rekrap/microde/python_avi_1_0/avi_for_python.html Hopefully it will be of use for those wishing to analyse avi frames - it is too slow for playback at any sort of reasonable frame rate. Also it only handles uncompressed frames but I have included plugin connections to allow for decompression. It works well with the PIL modules. Comments and improvements are welcome. Cheers Robert Parker From nop.head at googlemail.com Thu Apr 24 00:24:36 2008 From: nop.head at googlemail.com (nop head) Date: Wed, 23 Apr 2008 23:24:36 +0100 Subject: [Image-SIG] PIL ImageDraw.line(width) In-Reply-To: References: Message-ID: Hi, I am trying to draw thick lines with PIL 1.1.6 ImageDraw.draw.line() using the width parameter. If I draw a square with width=3 then each side has a different width: right to left is width 2, bottom to top width 3, left to right width 4 and top to bottom width 5. Is the function broken or am I missing the point? I am considering a workaround by computing the gradient and adjusting the width accordingly. Is this the correct approach? Has anybody coded this already? Regards, Chris From Chris.Barker at noaa.gov Thu Apr 24 00:54:58 2008 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Wed, 23 Apr 2008 15:54:58 -0700 Subject: [Image-SIG] selftest issues Message-ID: <480FBE42.4000107@noaa.gov> Hi, I'm playing with building PIL on OS_X and have run into an interesting issue. When I run selftest.py, and HAVE NOT built and installed the compiled extensions, selftest picks up the _imaging.so that is installed in my standard python installation, and runs just fine. However, then it didn't test the new build at all. It would be nice if selftest.py would only look in the local version, so I could make sure to be testing the right thing, without having to remove my working PIL install. hmmm -- maybe I can just remove the PIL.pth file -- I should be importing "from PIL" anyway... -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker at noaa.gov From kkthompson at tsl.state.tx.us Mon Apr 28 19:04:00 2008 From: kkthompson at tsl.state.tx.us (Kathleen Krause-Thompson) Date: Mon, 28 Apr 2008 12:04:00 -0500 Subject: [Image-SIG] FW: PIL Message-ID: <3064364B1677754AA932DCD58F55CD710108C928@exchange.win2k.tsl.state.tx.us> > We are getting the error below in Plone with PIL 1.1.6. Would it be best to uninstall and then install PIL? How should it be uninstalled please? Thanks. > > usr/local/src/Imaging-1.1.6$python selftest.py > ***************************************************************** > Failure in example: _info(Image.open("Images/lena.jpg")) > from line #24 of selftest.testimage > Exception raised: > Traceback (most recent call last): > File "./doctest.py", line 499, in _run_examples_inner > exec compile(source, "", "single") in globs > File "", line 1, in ? > File "./selftest.py", line 22, in _info > im.load() > File "PIL/ImageFile.py", line 180, in load > d = Image._getdecoder(self.mode, d, a, self.decoderconfig) > File "PIL/Image.py", line 375, in _getdecoder > raise IOError("decoder %s not available" % decoder_name) > IOError: decoder jpeg not available > 1 items had failures: > 1 of 57 in selftest.testimage > ***Test Failed*** 1 failures. > *** 1 tests of 57 failed. > > > > > > Kathleen Krause-Thompson > .Applications Development > IRT Division > Texas State Library and Archives Commission > 512-463-5485 > > > > From Chris.Barker at noaa.gov Mon Apr 28 21:40:10 2008 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Mon, 28 Apr 2008 12:40:10 -0700 Subject: [Image-SIG] FW: PIL In-Reply-To: <3064364B1677754AA932DCD58F55CD710108C928@exchange.win2k.tsl.state.tx.us> References: <3064364B1677754AA932DCD58F55CD710108C928@exchange.win2k.tsl.state.tx.us> Message-ID: <4816281A.1040507@noaa.gov> How did you install it? What OS, etc is this on? It looks like you've got a version without the jpeg library compiled in. You need a version that has got jpeg support, then you should be able to install it on top of the one there, -Chris Kathleen Krause-Thompson wrote: >> We are getting the error below in Plone with PIL 1.1.6. Would it be best to uninstall and then install PIL? How should it be uninstalled please? Thanks. >> >> usr/local/src/Imaging-1.1.6$python selftest.py >> ***************************************************************** >> IOError: decoder jpeg not available -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker at noaa.gov From kkthompson at tsl.state.tx.us Mon Apr 28 21:44:00 2008 From: kkthompson at tsl.state.tx.us (Kathleen Krause-Thompson) Date: Mon, 28 Apr 2008 14:44:00 -0500 Subject: [Image-SIG] FW: PIL In-Reply-To: <4816281A.1040507@noaa.gov> Message-ID: <3064364B1677754AA932DCD58F55CD710108C933@exchange.win2k.tsl.state.tx.us> It is on Debian Linus, 2.6.19.666. I am not sure how our data center rep installed it. That's part of the problem. It looks like this uses a library called jpeg-6b instaled of libjpeg. -----Original Message----- From: Christopher Barker [mailto:Chris.Barker at noaa.gov] Sent: Monday, April 28, 2008 2:40 PM To: Kathleen Krause-Thompson Cc: image-sig at python.org Subject: Re: [Image-SIG] FW: PIL How did you install it? What OS, etc is this on? It looks like you've got a version without the jpeg library compiled in. You need a version that has got jpeg support, then you should be able to install it on top of the one there, -Chris Kathleen Krause-Thompson wrote: >> We are getting the error below in Plone with PIL 1.1.6. Would it be best to uninstall and then install PIL? How should it be uninstalled please? Thanks. >> >> usr/local/src/Imaging-1.1.6$python selftest.py >> ***************************************************************** >> IOError: decoder jpeg not available -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker at noaa.gov From fredrik at pythonware.com Mon Apr 28 22:33:16 2008 From: fredrik at pythonware.com (Fredrik Lundh) Date: Mon, 28 Apr 2008 22:33:16 +0200 Subject: [Image-SIG] FW: PIL In-Reply-To: <3064364B1677754AA932DCD58F55CD710108C933@exchange.win2k.tsl.state.tx.us> References: <4816281A.1040507@noaa.gov> <3064364B1677754AA932DCD58F55CD710108C933@exchange.win2k.tsl.state.tx.us> Message-ID: Kathleen Krause-Thompson wrote: > It is on Debian Linus, 2.6.19.666. I am not sure how our data > center rep installed it. That's part of the problem. It looks > like this uses a library called jpeg-6b instaled of libjpeg. Those are two names for the same thing -- "jpeg-6b" is the name of the distribution, "libjpeg" the name of the library file on Unix systems. Can you install prebuilt packages on the machine? The Debian folks provide nice and carefully built packages for all recent versions; look for "python-imaging" (iirc, they have 1.1.5 in the stable repository and 1.1.6 in the testing release). From abhishekpathak88 at yahoo.co.in Tue Apr 29 04:48:30 2008 From: abhishekpathak88 at yahoo.co.in (Abhishek Pathak) Date: Tue, 29 Apr 2008 03:48:30 +0100 (BST) Subject: [Image-SIG] Problem taking snapshots using ImageGrab module in PIL Message-ID: <842180.15137.qm@web94006.mail.in2.yahoo.com> Hi, I am working on Image Processing and found Python using PIL good for prototyping, as I can quickly see what I have done. The problem is that when I am taking 'snapshots' of my computer screen using 'ImageGrab' module, then although it is working, but as it is maximized, so the command-window is also coming into view. alongwith any open folders. I am running this on windows. Is there a way out in python/PIL? Thanks in advance, Bye, Abhishek Pathak. Explore your hobbies and interests. Go to http://in.promos.yahoo.com/groups/ From jais at exalead.com Wed Apr 30 16:26:56 2008 From: jais at exalead.com (Stephane JAIS) Date: Wed, 30 Apr 2008 16:26:56 +0200 Subject: [Image-SIG] PNG Support with Parsed images. Message-ID: <3B776D10-5190-4E34-B4D9-0A6F2F7B9CFE@exalead.com> Hello, I'm trying to use ImageFile.Parser() to parse a PNG file like this: >>> import ImageFile >>> f = open('pic.png') >>> p=ImageFile.Parser() >>> p.feed(f.read()) >>> i=p.close() >>> i.show() And I'm getting: Traceback (most recent call last): File "", line 1, in ? File "/data/apogee/pythonpath/lib64/python2.4/site-packages/PIL/ Image.py", line 1449, in show _showxv(self, title, command) File "/data/apogee/pythonpath/lib64/python2.4/site-packages/PIL/ Image.py", line 2082, in _showxv file = image._dump(format=format) File "/data/apogee/pythonpath/lib64/python2.4/site-packages/PIL/ Image.py", line 476, in _dump self.load() File "/data/apogee/pythonpath/lib64/python2.4/site-packages/PIL/ ImageFile.py", line 189, in load s = read(self.decodermaxblock) File "/data/apogee/pythonpath/lib64/python2.4/site-packages/PIL/ PngImagePlugin.py", line 365, in load_read return self.fp.read(bytes) File "/data/apogee/pythonpath/lib64/python2.4/site-packages/PIL/ ImageFile.py", line 300, in read data = self.data[pos:pos+bytes] TypeError: unsubscriptable object The problem has been noted on that very list before: http://www.mailinglistarchive.com/image-sig at python.org/msg00513.html I am wandering if a bug report has been opened, and if any workaround exists. Thanks, Stephane From thebobuk at gmail.com Tue Apr 29 00:44:35 2008 From: thebobuk at gmail.com (Grigory Bakunov) Date: Tue, 29 Apr 2008 02:44:35 +0400 Subject: [Image-SIG] Outlined text Message-ID: Somebody have any good solutions to write outlined text?I have an idea to draw text with horizontal/vertical offsets but it's look realy ugly :( Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: From cafeeee at gmail.com Tue Apr 29 06:09:05 2008 From: cafeeee at gmail.com (cafeeee) Date: Tue, 29 Apr 2008 12:09:05 +0800 Subject: [Image-SIG] How to specify the color of a text Message-ID: <2e1bd0f90804282109i61982a2an55e73eecc9524853@mail.gmail.com> I failed to specify the color of the text while drawing a text into an image: >>> import Image, ImageDraw, ImageColor, ImageFont >>> image = Image.open("a.gif") >>> draw = ImageDraw.Draw(image) >>> font = ImageFont.truetype("arial.ttf", 15) >>> color = "blue" >>> draw.text((10, 10), "HELLO", fill=color, font=font) Traceback (most recent call last): File "", line 1, in File "D:\Program Files\Python25\Lib\site-packages\PIL\ImageDraw.py", line 256, in text ink, fill = self._getink(fill) File "D:\Program Files\Python25\Lib\site-packages\PIL\ImageDraw.py", line 145, in _getink ink = self.palette.getcolor(ink) File "D:\Program Files\Python25\Lib\site-packages\PIL\ImagePalette.py", line 62, in getcolor self.palette = map(int, self.palette) ValueError: invalid literal for int() with base 10: '' Any comment are appreciated. -------------- next part -------------- An HTML attachment was scrubbed... URL: From michele.petrazzo at unipex.it Wed Apr 30 23:04:27 2008 From: michele.petrazzo at unipex.it (Michele Petrazzo - Unipex srl) Date: Wed, 30 Apr 2008 23:04:27 +0200 Subject: [Image-SIG] How to specify the color of a text In-Reply-To: <2e1bd0f90804282109i61982a2an55e73eecc9524853@mail.gmail.com> References: <2e1bd0f90804282109i61982a2an55e73eecc9524853@mail.gmail.com> Message-ID: <4818DEDB.8090200@unipex.it> cafeeee wrote: > I failed to specify the color of the text while drawing a text into an > image: > >>>> import Image, ImageDraw, ImageColor, ImageFont >>>> image = Image.open("a.gif") >>>> draw = ImageDraw.Draw(image) >>>> font = ImageFont.truetype("arial.ttf", 15) >>>> color = "blue" >>>> draw.text((10, 10), "HELLO", fill=color, font=font) >>> color = 0,0,0 >>> draw.text((10, 10), "HELLO", fill=color) Here you can find all the PIL doc: http://www.pythonware.com/library/pil/handbook/imagedraw.htm From G.Kloss at massey.ac.nz Wed Apr 30 23:14:48 2008 From: G.Kloss at massey.ac.nz (Guy K. Kloss) Date: Thu, 1 May 2008 09:14:48 +1200 Subject: [Image-SIG] How to specify the color of a text In-Reply-To: <2e1bd0f90804282109i61982a2an55e73eecc9524853@mail.gmail.com> References: <2e1bd0f90804282109i61982a2an55e73eecc9524853@mail.gmail.com> Message-ID: <200805010914.48365.G.Kloss@massey.ac.nz> On Tue, 29 Apr 2008 4:09:05 pm cafeeee wrote: > >>> color = "blue" > >>> draw.text((10, 10), "HELLO", fill=color, font=font) > > Traceback (most recent call last): > ? File "", line 1, in > ? File "D:\Program Files\Python25\Lib\site-packages\PIL\ImageDraw.py", line > 256, in text ink, fill = self._getink(fill) > ? File "D:\Program Files\Python25\Lib\site-packages\PIL\ImageDraw.py", line > 145, in _getink ink = self.palette.getcolor(ink) > ? File "D:\Program Files\Python25\Lib\site-packages\PIL\ImagePalette.py", > line 62, in getcolor self.palette = map(int, self.palette) > ValueError: invalid literal for int() with base 10: '' Hmmm, the docmentation is here: http://www.pythonware.com/library/pil/handbook/imagedraw.htm It's a bit ambiguous, as on the top it states that colours can also use HTML like names (as you did), but further down it says for the options this: "fill: integer or tuple" So, is it possible that your version of PIL is < 1.1.4, or that your image type is incompatible with (that type of) colours? Just give the other options a shot as mentioned in the section "Colours" and/or "Colour Names". HTH, Guy -- Guy K. Kloss Institute of Information and Mathematical Sciences Te Kura Putaiao o Mohiohio me Pangarau Room 2.63, Quad Block A Building Massey University, Auckland, Albany Private Bag 102 904, North Shore Mail Centre voice: +64 9 414-0800 ext. 9585 ? fax: +64 9 441-8181 eMail: G.Kloss at massey.ac.nz ?http://www.massey.ac.nz/~gkloss/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part. URL: