From kxroberto at googlemail.com Thu Jul 2 15:58:22 2009 From: kxroberto at googlemail.com (Robert) Date: Thu, 02 Jul 2009 15:58:22 +0200 Subject: [Image-SIG] Workarounds for MemoryErrors In-Reply-To: <4A426CEF.7020601@ekran.org> References: <4A3FB6BD.50508@ekran.org> <4A408583.5030301@kopka.net> <4A426CEF.7020601@ekran.org> Message-ID: If you have a 64 bit OS, you can try Python mmap / numpy.memmap with Python2.6. And mmap objects have also the new buffer interface. Didn't try it so far with that sizes. PIL says in Image.frombuffer's doc that it can directly reuse existing buffers: "For some modes, the image memory will share memory with the original buffer (this means that changes to the original buffer object are reflected in the image). Not all modes can share memory; supported modes include "L", "RGBX", "RGBA", and "CMYK"." However it didn't work when I tried it recently - both with normal buffers (array.array / numpy.ndarray) and mmap. But buffer(a) tells about 'read-only'. Maybe with Py2.7 / Py3 .. Yet with numpy / scipy.ndimage you can perhaps also do your "collaging" neatly. Otherwise with 32bit (wonder who is using such big image), and in case its just about sticking rectangles and simple resizing, you can perhaps simply do some iteration over lines on file.seek(x+y*cx...) level Robert B. Bogart wrote: > Thanks all for your help. > > The code generates a large image from many small ones. > > So I'll just scale each image individually before collaging them. > > .b. > > Gregor Kopka wrote: >> Hello, >> >> to process a ~ 25GB (uncompressed image data) you are afaik out of luck >> with PIL. >> Only chance would be to use a fairly recent 64 bit OS with 64 bit python >> binaries (some custom patches /might/ be needed though) and give it a >> hefty amount of swapspace (at least eight times main memory) to fit the >> image into virtual memory, but then you would wait for the disk for >> hours (at best) or - depending on the operations you want to perform - >> way longer. >> >> The question of how to open the resulting image also arises... >> >> Since you didn't give any details on what you need as output format, or >> the operations you want to perform on the image while in memory (or >> whereever it might be at that point) it's hard to give any better clues. >> >> Regards, >> >> Gregor >> >> B. Bogart schrieb: >>> Hello all, >>> >>> I want to create a very large RGBA image (96000x72000 pixels). >>> >>> I have 4GB of RAM. >>> >>> Is there an easy way of getting around this error by having PIL only >>> allocate one section of the image at a time? >>> >>> If PIL does not have any internal trick to work with large images then >>> I'll have to make 4+ smaller images one at a time, but then I'm not sure >>> how I could combine them without needing to allocate a memory chunk for >>> the whole image. >>> >>> Otherwise I suppose I'll have to try with some other language, perhaps >>> C/SDL, though a quick calculation seems to show that such a large RGBA >>> image is just unworkable. Is there some way of using disk space rather >>> than memory? Does not matter if it is slow, just that it is possible! >>> >>> Any advice? >>> >>> Thanks, >>> B. >>> _______________________________________________ >>> Image-SIG maillist - Image-SIG at python.org >>> http://mail.python.org/mailman/listinfo/image-sig >>> >>> > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > From ulf.renman at favoptic.com Fri Jul 3 09:43:34 2009 From: ulf.renman at favoptic.com (Ulf Renman) Date: Fri, 03 Jul 2009 09:43:34 +0200 Subject: [Image-SIG] Bug in Image.rotate? Message-ID: <4A4DB6A6.60701@favoptic.com> Hi Two diffrent uses of rotate: 1. img.rotate(30, Image.BICUBIC) 2. img.rotate(30, Image.BICUBIC, expand=True) When I use the first one I get the expected result. But when I use the second one the result looks as if the filter used for the rotation was Image.NEAREST. Is this a "feature" or a bug? I'm no expert at image handling, so please explain this to me. Thanks. Context: Ubuntu 8.10, Python 2.5.2 and PIL 1.1.6 Testprogram: #!/usr/bin/python import Image import ImageDraw # Create a testimage orig = Image.new('RGB',(250,250)) for x in range(0,250,50): for y in range(0,250,50): c = (x,y,100) orig.paste(c,(x,y,x+50,y+50)) # Create a target image imout = Image.new('RGB', (750,600)) # Paste the orig image in various ways imout.paste(orig,(0,0)) imout.paste(orig.rotate(30,Image.NEAREST), (250,0)) imout.paste(orig.rotate(30,Image.BICUBIC,False), (500,0)) imout.paste(orig.rotate(30,Image.BICUBIC,True), (300,250)) # Put some labels on the output draw = ImageDraw.Draw(imout) draw.text((10,10),'Original',fill=(255,255,0)) draw.text((260,10),'30 degrees, NEAREST, expand=False',fill=(255,255,0)) draw.text((510,10),'30 degrees, BICUBIC, expand=False',fill=(255,255,0)) draw.text((310,500),'30 degrees, BICUBIC, expand=True',fill=(255,255,0)) imout.show() ### end of program ### /Ulf Renman From fredrik at pythonware.com Fri Jul 3 11:57:37 2009 From: fredrik at pythonware.com (Fredrik Lundh) Date: Fri, 3 Jul 2009 11:57:37 +0200 Subject: [Image-SIG] Bug in Image.rotate? In-Reply-To: <4A4DB6A6.60701@favoptic.com> References: <4A4DB6A6.60701@favoptic.com> Message-ID: <368a5cd50907030257j43abb859s633c1affa9fef330@mail.gmail.com> On Fri, Jul 3, 2009 at 9:43 AM, Ulf Renman wrote: > Hi > > Two diffrent uses of rotate: > > ?1. img.rotate(30, Image.BICUBIC) > ?2. img.rotate(30, Image.BICUBIC, expand=True) > > When I use the first one I get the expected result. But when I use the > second one the result looks as if the filter used for the rotation was > Image.NEAREST. > > Is this a "feature" or a bug? I'm no expert at image handling, so please > explain this to me. Thanks. It's a bug in 1.1.6; the fix is part of this patch: http://hg.effbot.org/pil-2009-raclette/changeset/db1b40ca85c4/ From ulf.renman at favoptic.com Wed Jul 1 11:38:49 2009 From: ulf.renman at favoptic.com (Ulf Renman) Date: Wed, 01 Jul 2009 11:38:49 +0200 Subject: [Image-SIG] Bug in Image.rotate ? Message-ID: <4A4B2EA9.20006@favoptic.com> Hi Two diffrent uses of rotate: 1. img.rotate(30, Image.BICUBIC) 2. img.rotate(30, Image.BICUBIC, expand=True) When I use the first one I get the expected result. But when I use the second one the result looks as if the filter used for the rotation was Image.NEAREST. Is this a "feature" or a bug? I'm no expert at image handling, so please explain this to me. Thanks. Context: Ubuntu 8.10, Python 2.5.2 and PIL 1.1.6 Pasted from help(Image): # $Id: Image.py 2933 2006-12-03 12:08:22Z fredrik $ /Ulf Renman From hdg at cox.net Fri Jul 3 09:08:42 2009 From: hdg at cox.net (H David Goering) Date: Fri, 3 Jul 2009 02:08:42 -0500 Subject: [Image-SIG] PIL build instructions are unclear Message-ID: <4B50BD7E-726F-4DAA-8A65-2D597F3713D0@cox.net> Re: Freetype2-dev_2.1.3-22_darwin-i386 Imaging 1.1.5 Python 2.6.2 Mac OS X 10.4.11 Mac Mini Intel Core Duo The build instructions for Imaging 1.1.5 dealing with Freetype2 support are unclear. I have attempted to follow the instructions in README and setup.py, but some requirements seem glossed over, and my attempts to guess at interpretations have failed. In particular: Instruction #3. The Python installation is a fresh framework build, but no filenames including "python-devel" are found. What does "probably" mean? What does "or similar" mean? Instruction #4: I do not seem to have a Python extensions directory. What would be a "suitable directory"? Instruction #5: What does "in-place" mean? How can I tell if Freetype is properly installed? setup.py documentation: what would be "well-known library location" for Freetype2? What would a directory that is an appropriate value for FREETYPE_ROOT contain? Any clarification is welcome. Thanks, David Goering From g.kloss at massey.ac.nz Sun Jul 5 03:31:52 2009 From: g.kloss at massey.ac.nz (Guy K. Kloss) Date: Sun, 5 Jul 2009 13:31:52 +1200 Subject: [Image-SIG] writing 16 bit per channel images? Message-ID: <200907051331.53003.g.kloss@massey.ac.nz> Hi, does anybody know how one would be able to write 16 bit per channel images? Preferably PNGs or TIFFs, but could also be others. It seems like PIL can't handle that, and OpenCV (with its Python bindings) doesn't seem to be capable of that, either. The only thing I found is PyPNG: http://packages.python.org/pypng/ca.html But it's not by default in my Ubuntu repositories. Any other ideas or experience with an issue like that? Guy -- Guy K. Kloss Institute of Information and Mathematical Sciences Te Kura P?taiao o M?hiohio me P?ngarau Massey University, Albany (North Shore City, Auckland) 473 State Highway 17, Gate 1, Mailroom, Quad B Building voice: +64 9 414-0800 ext. 9585 fax: +64 9 441-8181 G.Kloss at massey.ac.nz http://www.massey.ac.nz/~gkloss From lubensch.proletariat.inc at gmail.com Mon Jul 6 15:01:21 2009 From: lubensch.proletariat.inc at gmail.com (Chris Ps) Date: Mon, 6 Jul 2009 16:01:21 +0300 Subject: [Image-SIG] writing 16 bit per channel images? (Guy K. Kloss) Message-ID: Did you try GDAL? It comes with a python interface and supports a large number of exotic raster formats. I'm not sure if it supports 16bits per channel, but most probably it does. You should check it out. From skyewm at gmail.com Mon Jul 6 22:19:21 2009 From: skyewm at gmail.com (Skye WM) Date: Mon, 6 Jul 2009 13:19:21 -0700 Subject: [Image-SIG] Image.transform and antialias Message-ID: <70ec9aab0907061319r51c25bcbuccb6097c26b253aa@mail.gmail.com> Hello, I was wondering why Image's transform method doesn't support the ANTIALIAS filter while the methods resize and thumbnail do. I'm trying to crop and resize, and it'd be nice to do it all in one command. Thanks, Skye -------------- next part -------------- An HTML attachment was scrubbed... URL: From shula.amokshim at gmx.com Tue Jul 7 01:04:12 2009 From: shula.amokshim at gmx.com (Shula Amokshim) Date: Tue, 07 Jul 2009 02:04:12 +0300 Subject: [Image-SIG] bug report: font sometimes not obeying kerning rules Message-ID: <4A5282EC.9020700@gmx.com> Writing Latin text on an image using PIL is easy. However, when I try to write Hebrew punctuation marks (called "nikud" or ?????), the characters does not overlap (as it should). On supporting environment, these two words take up the same space/width (the below example depend on your system, hence the image): ????? ??? However when drawing the text with PIL i'd get ? ? ? ? ? Since the library probably doesn't obey kerning(?) rules,the error (latter example) occurs in all the ttf fonts I have installed (200+) beside DejaVuSans.ttf and Lucida*.ttf, on which it works OK. See example as an image (url: http://tinypic.com/r/jglhc5/5) See differences in rendering among various fonts http://tinypic.com/view.php?pic=sgiu1i&s=3 I guess this question is relevant also to Arabic and other similar languages with overlapping characters. Note: there's also a "bug" (or an unimplemented feature) not dealing with bidirectional (bidi-, RTL) fonts. Meaning, Hebrew text on the image is printed backwards. But that's another issue. Here's my original discusstion on StackOverflow: http://stackoverflow.com/questions/993265/writing-text-with-diacritic-nikud-vocalization-marks-using-pil-python-image -------------- next part -------------- An HTML attachment was scrubbed... URL: From jpmieville at gmail.com Tue Jul 7 14:02:36 2009 From: jpmieville at gmail.com (=?ISO-8859-1?Q?Jean=2DPaul_Mi=E9ville?=) Date: Tue, 7 Jul 2009 14:02:36 +0200 Subject: [Image-SIG] ImageTk.PhotoImage: DLL load failed: The specified module could not be found. Message-ID: Hello, I have an problem with ImageTk.PhotoImage. When I try to use it with for example with the following script: import ImageTk import Image import tkFileDialog imgFile = tkFileDialog.askopenfilename() if imgFile: image = Image.open(imgFile) chart = ImageTk.PhotoImage(image) I got the following error: Traceback (most recent call last): File "C:\Python\PythonScript\Test\Script1.py", line 9, in chart = ImageTk.PhotoImage(image) File "C:\Python25\Lib\site-packages\PIL\ImageTk.py", line 116, in __init__ self.paste(image) File "C:\Python25\Lib\site-packages\PIL\ImageTk.py", line 181, in paste import _imagingtk ImportError: DLL load failed: The specified module could not be found. The file _imagingtk is present in the path C:\Python25\Lib\site-packages\PIL\. I don't understand what is wrong. I am using ActivePython 2.5.4.4 (ActiveState Software Inc.)base on Python 2.5.4 (r254:67916, Apr 27 2009, 15:41:14). Thanks for your help, Jean-Paul -------------- next part -------------- An HTML attachment was scrubbed... URL: From jpmieville at gmail.com Wed Jul 8 12:24:52 2009 From: jpmieville at gmail.com (=?ISO-8859-1?Q?Jean=2DPaul_Mi=E9ville?=) Date: Wed, 8 Jul 2009 12:24:52 +0200 Subject: [Image-SIG] ImageTk.PhotoImage: DLL load failed: The specified module could not be found. Message-ID: Hello, I have an problem with ImageTk.PhotoImage. When I try to use it with for example with the following script: import ImageTk import Image import tkFileDialog imgFile = tkFileDialog.askopenfilename() if imgFile: ?? ?image = Image.open(imgFile) ?? ?chart = ImageTk.PhotoImage(image) I got the following error: Traceback (most recent call last): ??File "C:\Python\PythonScript\Test\Script1.py", line 9, in ?? ?chart = ImageTk.PhotoImage(image) ??File "C:\Python25\Lib\site-packages\PIL\ImageTk.py", line 116, in __init__ ?? ?self.paste(image) ??File "C:\Python25\Lib\site-packages\PIL\ImageTk.py", line 181, in paste ?? ?import _imagingtk ImportError: DLL load failed: The specified module could not be found. The file _imagingtk is present in the path?C:\Python25\Lib\site-packages\PIL\. I don't understand what is wrong. I am using?ActivePython 2.5.4.4 (ActiveState Software Inc.)base on?Python 2.5.4 (r254:67916, Apr 27 2009, 15:41:14). Thanks for your help, Jean-Paul From tejovathi.p at gmail.com Wed Jul 8 16:29:07 2009 From: tejovathi.p at gmail.com (Tejovathi P) Date: Wed, 8 Jul 2009 15:29:07 +0100 Subject: [Image-SIG] Regarding ImageFont and font style Message-ID: Hi All, I am pretty new to PIL.I am trying to create a font using ImageFont.truetype, specifying the font path and size. But if I want to specify the font be *bold*, how do I do that? Any options other than creating a separate boldfont.ttf??? Thanks a lot Cheers, Teja -------------- next part -------------- An HTML attachment was scrubbed... URL: From fredrik at pythonware.com Thu Jul 9 12:53:41 2009 From: fredrik at pythonware.com (Fredrik Lundh) Date: Thu, 9 Jul 2009 12:53:41 +0200 Subject: [Image-SIG] Regarding ImageFont and font style In-Reply-To: References: Message-ID: <368a5cd50907090353s57072b79s8f8a7219ffad21b0@mail.gmail.com> On Wed, Jul 8, 2009 at 4:29 PM, Tejovathi P wrote: > Hi All, > I am pretty new to PIL.I am trying to create a font > using??ImageFont.truetype, specifying the font path and size. But if I want > to specify the font be *bold*, how do I do that? > Any options other than creating a separate boldfont.ttf??? Bold and italic typefaces are usually separate designs from the "regular" version, so TrueType/OpenType fonts usually consist of a number of separate font files. PIL has no support for synthetic font manipulations (and there's nothing built in to FreeType either, even if you can simulate some styles using low-level outline transforms). From fredrik at pythonware.com Thu Jul 9 13:23:05 2009 From: fredrik at pythonware.com (Fredrik Lundh) Date: Thu, 9 Jul 2009 13:23:05 +0200 Subject: [Image-SIG] Image.transform and antialias In-Reply-To: <70ec9aab0907061319r51c25bcbuccb6097c26b253aa@mail.gmail.com> References: <70ec9aab0907061319r51c25bcbuccb6097c26b253aa@mail.gmail.com> Message-ID: <368a5cd50907090423p2135acaetf37b8e9127a1181b@mail.gmail.com> On Mon, Jul 6, 2009 at 10:19 PM, Skye WM wrote: > I was wondering why Image's transform method doesn't support the ANTIALIAS > filter while the methods resize and thumbnail do. I'm trying to crop and > resize, and it'd be nice to do it all in one command. The transform machinery works with arbitrary transformations, while the ANTIALIAS machinery only works for rectangle-to-rectangle mappings. I guess this could be special-cased for the EXTENT transform, or, perhaps better, resize could be made a bit more clever it preceeded by a crop, but in the current release, you have to do it in two steps. (if you're primarily working from JPEG images on disk, it's probably most efficient to do thumbnail followed by crop. For other formats/sizes, doing it the other way around might be more efficient.) From fredrik at pythonware.com Thu Jul 9 13:26:24 2009 From: fredrik at pythonware.com (Fredrik Lundh) Date: Thu, 9 Jul 2009 13:26:24 +0200 Subject: [Image-SIG] ImageTk.PhotoImage: DLL load failed: The specified module could not be found. In-Reply-To: References: Message-ID: <368a5cd50907090426h437b650eu7aca21373524f06c@mail.gmail.com> On Wed, Jul 8, 2009 at 12:24 PM, Jean-Paul Mi?ville > I have an problem with ImageTk.PhotoImage. > > When I try to use it with for example with the following script: > > import ImageTk > import Image > import tkFileDialog > imgFile = tkFileDialog.askopenfilename() > if imgFile: > ?? ?image = Image.open(imgFile) > ?? ?chart = ImageTk.PhotoImage(image) > > I got the following error: > > Traceback (most recent call last): > ??File "C:\Python\PythonScript\Test\Script1.py", line 9, in > ?? ?chart = ImageTk.PhotoImage(image) > ??File "C:\Python25\Lib\site-packages\PIL\ImageTk.py", line 116, in __init__ > ?? ?self.paste(image) > ??File "C:\Python25\Lib\site-packages\PIL\ImageTk.py", line 181, in paste > ?? ?import _imagingtk > ImportError: DLL load failed: The specified module could not be found. > The file _imagingtk is present in the path?C:\Python25\Lib\site-packages\PIL\. > > I don't understand what is wrong. I am using?ActivePython 2.5.4.4 > (ActiveState Software Inc.)base on?Python 2.5.4 (r254:67916, Apr 27 > 2009, 15:41:14). Most likely, it cannot find the Tcl/Tk DLL:s. You should get a slightly more informative error message if you run Python in a console window and type: import _imagingtk What Tcl/Tk version is ActiveState's 2.5.4.4 distribution using, btw? To find out, do: >>> import Tkinter >>> print Tkinter.TclVersion If this says something other than 8.4, your AS release isn't compatible with the python.org builds. From tbaldwin at uoregon.edu Thu Jul 9 23:50:58 2009 From: tbaldwin at uoregon.edu (Tom Baldwin) Date: Thu, 9 Jul 2009 14:50:58 -0700 Subject: [Image-SIG] Help: Converting PIL to Tkinter image objects crashes python Message-ID: Hey everyone, I'm having some trouble displaying PIL image objects in a Tkinter window, and I'm looking for help. The function PIL.ImageTk.PhotoImage fails and crashes python, displaying the following (unhelpful) error message in the terminal: alloc: invalid block: 0x708338: b0 0 0 Abort trap I have attached a quick program which should demonstrate the problem (replace 'ex.jpg' with any image which you have). I have searched the internet for help and haven't found a solution. Moreover, I tried running some sample scripts found in tutorials online, and they fail in the same manner. This leads me to believe that there's a bug in PIL, or a problem with my installation, which leads to this incompatibility. I am running python 2.6.2 on Mac OS 10.5. I installed everything from source using Macports. My Tcl/Tk version is 8.5.6, and my PIL version is 1.1.6. For what it's worth, this also happens on my Python 2.5 installation. A python-help volunteer suggested downgrading my Tcl/Tk installation from 8.5 to 8.4, which seems a little weird, since 8.5 has been stable since December 2007. (Also, downgrading things using Macports is so complicated that I haven't succeeding in doing it yet.) He directed me to this list for more knowledgeable help. Can anyone with PIL familiarity tell me what might be causing this error? Or say if there is any reason to believe that Tcl 8.4 might be more compatible? Thank you for any help you can give. Tom -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: reproducer.py Type: application/octet-stream Size: 516 bytes Desc: not available URL: From fredrik at pythonware.com Fri Jul 10 00:44:25 2009 From: fredrik at pythonware.com (Fredrik Lundh) Date: Fri, 10 Jul 2009 00:44:25 +0200 Subject: [Image-SIG] Help: Converting PIL to Tkinter image objects crashes python In-Reply-To: References: Message-ID: <368a5cd50907091544q46f58207k94494162166bc8fc@mail.gmail.com> On Thu, Jul 9, 2009 at 11:50 PM, Tom Baldwin wrote: > A python-help volunteer suggested downgrading my Tcl/Tk installation from > 8.5 to 8.4, which seems a little weird, since 8.5 has been stable since > December 2007. 1.1.6 was released in december 2006, and core Python didn't switch to 8.5 until release 2.6 in late 2008 (iirc). > (Also, downgrading things using Macports is so complicated > that I haven't succeeding in doing it yet.) He directed me to this list for > more knowledgeable help. > > Can anyone with PIL familiarity tell me what might be causing this error? Or > say if there is any reason to believe that Tcl 8.4 might be more compatible? Instead of downgrading the Tcl/Tk install, you could try updating to the 1.1.7 trunk version of Tk/tkImaging.c module, available from: http://hg.effbot.org/pil-2009-raclette/raw/tip/Tk/tkImaging.c There's been a couple of tweaks related to 8.4/8.5 compatibility; not sure if they affect your specific case, but since you're building from source, it shouldn't be that hard for you test this. From tejovathi.p at gmail.com Thu Jul 9 13:00:21 2009 From: tejovathi.p at gmail.com (Tejovathi P) Date: Thu, 9 Jul 2009 12:00:21 +0100 Subject: [Image-SIG] Regarding ImageFont and font style In-Reply-To: <368a5cd50907090353s57072b79s8f8a7219ffad21b0@mail.gmail.com> References: <368a5cd50907090353s57072b79s8f8a7219ffad21b0@mail.gmail.com> Message-ID: Thanks for your reply........... On Thu, Jul 9, 2009 at 11:53 AM, Fredrik Lundh wrote: > On Wed, Jul 8, 2009 at 4:29 PM, Tejovathi P wrote: > > Hi All, > > I am pretty new to PIL.I am trying to create a font > > using ImageFont.truetype, specifying the font path and size. But if I > want > > to specify the font be *bold*, how do I do that? > > Any options other than creating a separate boldfont.ttf??? > > Bold and italic typefaces are usually separate designs from the > "regular" version, so TrueType/OpenType fonts usually consist of a > number of separate font files. > > PIL has no support for synthetic font manipulations (and there's > nothing built in to FreeType either, even if you can simulate some > styles using low-level outline transforms). > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From virtueoftheabsurd at gmail.com Thu Jul 9 17:49:49 2009 From: virtueoftheabsurd at gmail.com (Ari Gold-Parker) Date: Thu, 9 Jul 2009 11:49:49 -0400 Subject: [Image-SIG] Trouble compiling aggdraw on Ubuntu 9.2 64-bit Message-ID: <7ddf8e3b0907090849g4203d00ese33b7a38c07a5311@mail.gmail.com> I'm not worried about freetype, but I would really like aggdraw to install properly so I can use it with RDKit, computational chemistry software. aryeh at aryeh-laptop:~/Desktop/aggdraw-1.2a3-20060212$ python setup.py install running install running build running build_ext building 'aggdraw' extension gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DHAVE_FREETYPE2 -Iagg2/include -Iagg2/font_freetype -I/usr/lib/include -I/usr/lib/include/freetype2 -I/usr/include/python2.6 -c aggdraw.cxx -o build/temp.linux-x86_64-2.6/aggdraw.o cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++ In file included from aggdraw.cxx:69: agg2/font_freetype/agg_font_freetype.h:23:22: error: ft2build.h: No such file or directory agg2/font_freetype/agg_font_freetype.h:24:10: error: #include expects "FILENAME" or In file included from agg2/font_freetype/agg_font_freetype.h:28, from aggdraw.cxx:69: agg2/include/agg_scanline_storage_bin.h: In member function ?unsigned int agg::scanline_storage_bin::byte_size() const?: agg2/include/agg_scanline_storage_bin.h:247: warning: unused variable ?sp? In file included from aggdraw.cxx:69: agg2/font_freetype/agg_font_freetype.h: At global scope: agg2/font_freetype/agg_font_freetype.h:60: error: ?FT_Encoding? has not been declared agg2/font_freetype/agg_font_freetype.h:81: error: ?FT_Encoding? does not name a type agg2/font_freetype/agg_font_freetype.h:119: error: ?FT_Encoding? does not name a type agg2/font_freetype/agg_font_freetype.h:123: error: ?FT_Matrix? does not name a type agg2/font_freetype/agg_font_freetype.h:127: error: ?FT_Library? does not name a type agg2/font_freetype/agg_font_freetype.h:128: error: ISO C++ forbids declaration of ?FT_Face? with no type agg2/font_freetype/agg_font_freetype.h:128: error: expected ?;? before ?*? token agg2/font_freetype/agg_font_freetype.h:133: error: ?FT_Face? does not name a type aggdraw.cxx:179: error: ?FT_Face? does not name a type aggdraw.cxx: In member function ?void draw_adaptor::drawtext(float*, PyObject*, FontObject*)?: aggdraw.cxx:362: error: ?FT_Face? was not declared in this scope aggdraw.cxx:362: error: expected ?;? before ?face? aggdraw.cxx:363: error: ?face? was not declared in this scope aggdraw.cxx:367: error: ?face? was not declared in this scope aggdraw.cxx: In function ?void draw_setup(DrawObject*)?: aggdraw.cxx:457: warning: deprecated conversion from string constant to ?char*? aggdraw.cxx:460: warning: deprecated conversion from string constant to ?char*? aggdraw.cxx:463: warning: deprecated conversion from string constant to ?char*? aggdraw.cxx:466: warning: deprecated conversion from string constant to ?char*? aggdraw.cxx: In function ?PyObject* draw_new(PyObject*, PyObject*)?: aggdraw.cxx:572: warning: deprecated conversion from string constant to ?char*? aggdraw.cxx: In function ?agg::rgba8 getcolor(PyObject*, int)?: aggdraw.cxx:778: warning: deprecated conversion from string constant to ?char*? aggdraw.cxx: In function ?PyObject* draw_textsize(DrawObject*, PyObject*)?: aggdraw.cxx:1074: error: ?FT_Face? was not declared in this scope aggdraw.cxx:1074: error: expected ?;? before ?face? aggdraw.cxx:1075: error: ?face? was not declared in this scope aggdraw.cxx:1084: error: ?face? was not declared in this scope aggdraw.cxx:1084: error: ?FT_Get_Char_Index? was not declared in this scope aggdraw.cxx:1086: error: ?FT_LOAD_DEFAULT? was not declared in this scope aggdraw.cxx:1086: error: ?FT_Load_Glyph? was not declared in this scope aggdraw.cxx:1092: error: ?face? was not declared in this scope aggdraw.cxx: In function ?PyObject* draw_flush(DrawObject*, PyObject*)?: aggdraw.cxx:1239: warning: deprecated conversion from string constant to ?char*? aggdraw.cxx:1239: warning: deprecated conversion from string constant to ?char*? aggdraw.cxx: In function ?PyObject* pen_new(PyObject*, PyObject*, PyObject*)?: aggdraw.cxx:1331: warning: deprecated conversion from string constant to ?char*? aggdraw.cxx:1331: warning: deprecated conversion from string constant to ?char*? aggdraw.cxx:1331: warning: deprecated conversion from string constant to ?char*? aggdraw.cxx: In function ?PyObject* brush_new(PyObject*, PyObject*, PyObject*)?: aggdraw.cxx:1362: warning: deprecated conversion from string constant to ?char*? aggdraw.cxx:1362: warning: deprecated conversion from string constant to ?char*? aggdraw.cxx: In function ?PyObject* font_new(PyObject*, PyObject*, PyObject*)?: aggdraw.cxx:1393: warning: deprecated conversion from string constant to ?char*? aggdraw.cxx:1393: warning: deprecated conversion from string constant to ?char*? aggdraw.cxx:1393: warning: deprecated conversion from string constant to ?char*? aggdraw.cxx:1393: warning: deprecated conversion from string constant to ?char*? aggdraw.cxx:1410: error: ?font_load? was not declared in this scope aggdraw.cxx: At global scope: aggdraw.cxx:1427: error: ?FT_Face? does not name a type aggdraw.cxx: In function ?PyObject* font_getattr(FontObject*, char*)?: aggdraw.cxx:1448: error: ?FT_Face? was not declared in this scope aggdraw.cxx:1448: error: expected ?;? before ?face? aggdraw.cxx:1450: error: ?face? was not declared in this scope aggdraw.cxx:1450: error: ?font_load? was not declared in this scope aggdraw.cxx:1458: error: ?face? was not declared in this scope aggdraw.cxx:1458: error: ?font_load? was not declared in this scope aggdraw.cxx:1466: error: ?face? was not declared in this scope aggdraw.cxx:1466: error: ?font_load? was not declared in this scope aggdraw.cxx:1474: error: ?face? was not declared in this scope aggdraw.cxx:1474: error: ?font_load? was not declared in this scope In file included from agg2/font_freetype/agg_font_freetype.h:35, from aggdraw.cxx:69: agg2/include/agg_font_cache_manager.h: In member function ?void agg::font_cache_manager::init_embedded_adaptors(const agg::glyph_cache*, double, double) [with FontEngine = agg::font_engine_freetype_int32]?: aggdraw.cxx:381: instantiated from ?void draw_adaptor::drawtext(float*, PyObject*, FontObject*) [with PixFmt = agg::pixel_formats_rgba32]? aggdraw.cxx:1940: instantiated from here agg2/include/agg_font_cache_manager.h:306: warning: enumeration value ?glyph_data_invalid? not handled in switch error: command 'gcc' failed with exit status 1 Any idea what is going wrong here? -------------- next part -------------- An HTML attachment was scrubbed... URL: From tbaldwin at uoregon.edu Fri Jul 10 01:31:55 2009 From: tbaldwin at uoregon.edu (Tom Baldwin) Date: Thu, 9 Jul 2009 16:31:55 -0700 Subject: [Image-SIG] Help: Converting PIL to Tkinter image objects crashes python In-Reply-To: <368a5cd50907091544q46f58207k94494162166bc8fc@mail.gmail.com> References: <368a5cd50907091544q46f58207k94494162166bc8fc@mail.gmail.com> Message-ID: Thanks, Fredrik. If 1.1.6 is from 2006 then trying 1.1.7 code sounds like a very good idea. I wasn't sure how to set up the individual tkImaging module which you linked, so I downloaded and built the entire recent beta release, 1.1.7b1. I confirmed that python is seeing the new version: >>>import Image >>>Image.VERSION '1.1.7b1' However, my reproducer.py test script still fails in the same way as before. Whatever is going on must have slipped past any of the updates in the beta release, I guess. TkB On Thu, Jul 9, 2009 at 3:44 PM, Fredrik Lundh wrote: > On Thu, Jul 9, 2009 at 11:50 PM, Tom Baldwin wrote: > > > A python-help volunteer suggested downgrading my Tcl/Tk installation from > > 8.5 to 8.4, which seems a little weird, since 8.5 has been stable since > > December 2007. > > 1.1.6 was released in december 2006, and core Python didn't switch to > 8.5 until release 2.6 in late 2008 (iirc). > > > (Also, downgrading things using Macports is so complicated > > that I haven't succeeding in doing it yet.) He directed me to this list > for > > more knowledgeable help. > > > > Can anyone with PIL familiarity tell me what might be causing this error? > Or > > say if there is any reason to believe that Tcl 8.4 might be more > compatible? > > Instead of downgrading the Tcl/Tk install, you could try updating to > the 1.1.7 trunk version of Tk/tkImaging.c module, available from: > > http://hg.effbot.org/pil-2009-raclette/raw/tip/Tk/tkImaging.c > > There's been a couple of tweaks related to 8.4/8.5 compatibility; not > sure if they affect your specific case, but since you're building from > source, it shouldn't be that hard for you test this. > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tbaldwin at uoregon.edu Fri Jul 10 22:50:46 2009 From: tbaldwin at uoregon.edu (Tom Baldwin) Date: Fri, 10 Jul 2009 13:50:46 -0700 Subject: [Image-SIG] Help: Converting PIL to Tkinter image objects crashes python In-Reply-To: References: <368a5cd50907091544q46f58207k94494162166bc8fc@mail.gmail.com> Message-ID: Hello everyone, Today I tested for this bug having downgraded my Tcl/Tk from 8.5 to 8.4. I also downgraded PIL back to 1.1.6. My reproducer script still finds the bug on both python 2.5 and 2.6 interpreters, displaying error message: alloc: invalid block: 0x67dfa4: 60 0 0 Abort trap as before. I think this establishes that my problem is not a Tcl compatibility issue of 8.5 vs. 8.4. If I had to guess, I would say that it is a bug in the ImageTk library, but the affected functionality is so fundamental (displaying PIL images in a window) that I have to imagine that this would already be known, if so. Has anyone seen this error message when working with PIL, and knows what it means? TkB On Thu, Jul 9, 2009 at 4:31 PM, Tom Baldwin wrote: > Thanks, Fredrik. > > If 1.1.6 is from 2006 then trying 1.1.7 code sounds like a very good idea. > I wasn't sure how to set up the individual tkImaging module which you > linked, so I downloaded and built the entire recent beta release, 1.1.7b1. > > I confirmed that python is seeing the new version: > >>>import Image > >>>Image.VERSION > '1.1.7b1' > > However, my reproducer.py test script still fails in the same way as > before. > > Whatever is going on must have slipped past any of the updates in the beta > release, I guess. > > TkB > > > On Thu, Jul 9, 2009 at 3:44 PM, Fredrik Lundh wrote: > >> On Thu, Jul 9, 2009 at 11:50 PM, Tom Baldwin wrote: >> >> > A python-help volunteer suggested downgrading my Tcl/Tk installation >> from >> > 8.5 to 8.4, which seems a little weird, since 8.5 has been stable since >> > December 2007. >> >> 1.1.6 was released in december 2006, and core Python didn't switch to >> 8.5 until release 2.6 in late 2008 (iirc). >> >> > (Also, downgrading things using Macports is so complicated >> > that I haven't succeeding in doing it yet.) He directed me to this list >> for >> > more knowledgeable help. >> > >> > Can anyone with PIL familiarity tell me what might be causing this >> error? Or >> > say if there is any reason to believe that Tcl 8.4 might be more >> compatible? >> >> Instead of downgrading the Tcl/Tk install, you could try updating to >> the 1.1.7 trunk version of Tk/tkImaging.c module, available from: >> >> http://hg.effbot.org/pil-2009-raclette/raw/tip/Tk/tkImaging.c >> >> There's been a couple of tweaks related to 8.4/8.5 compatibility; not >> sure if they affect your specific case, but since you're building from >> source, it shouldn't be that hard for you test this. >> >> >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From fbuchinger at gmail.com Sat Jul 11 12:35:39 2009 From: fbuchinger at gmail.com (Franz Buchinger) Date: Sat, 11 Jul 2009 12:35:39 +0200 Subject: [Image-SIG] Estimating compression quality of existing JPEG files Message-ID: I want to estimate the quality of uploaded JPEG files by analyzing their Quantization Tables (DQTs). Is there a way to do this with PIL? I already figured out the Image.quantization property, but without some quantization array ==> JPEG quality mapping I can't make assumptions on the quality. Exiftool provides an enormous amount of JPEG DQT checksums in this module: http://cpansearch.perl.org/src/EXIFTOOL/Image-ExifTool-7.82/lib/Image/ExifTool/JPEGDigest.pm I really like to build on that dataset, but this implies that I make my quantization hashing function compatible to the one of Exiftool and eventually need to access the raw DQT. Any hints on that? nice regards, Franz -------------- next part -------------- An HTML attachment was scrubbed... URL: From kevin at cazabon.com Tue Jul 14 05:31:14 2009 From: kevin at cazabon.com (Kevin Cazabon) Date: Mon, 13 Jul 2009 23:31:14 -0400 Subject: [Image-SIG] feature detection/location in images Message-ID: Hey everyone - does anyone have good experience in locating features in an image? PilPlus used to have a "ImageCrackCode" module, but I've never used it or even seen it (it says no longer available). I don't need to find _specific_ features, but need to find a small set of distinct features consistently in similar images (for aligning them together). I can brute-force this with min/max values/etc, but was hoping for some help on something more elegant and efficient. Any pointers would be appreciated, thanks! Kevin. From g.kloss at massey.ac.nz Tue Jul 14 06:37:21 2009 From: g.kloss at massey.ac.nz (Guy K. Kloss) Date: Tue, 14 Jul 2009 16:37:21 +1200 Subject: [Image-SIG] feature detection/location in images In-Reply-To: References: Message-ID: <200907141637.21124.g.kloss@massey.ac.nz> On Tue, 14 Jul 2009 15:31:14 Kevin Cazabon wrote: > I don't need to find specific features, but need to find a small set > of distinct features consistently in similar images (for aligning them > together). I can brute-force this with min/max values/etc, but was > hoping for some help on something more elegant and efficient. Any > pointers would be appreciated, thanks! I've accomplished something similar using OpenCV functions that correlate a template to an area and return a matrix of correlation ratings. Then finding in the matrix the extreme value (max or min depending on the function) you can find your "best match". Currently I'd advise the ctypes-opencv bindings by Minh-Tri Pham to use the code from Python. It's quite speedy and works well, just need to play a bit with the functions to find out which works best for your case. HTH, Guy -- Guy K. Kloss Institute of Information and Mathematical Sciences Te Kura P?taiao o M?hiohio me P?ngarau Massey University, Albany (North Shore City, Auckland) 473 State Highway 17, Gate 1, Mailroom, Quad B Building voice: +64 9 414-0800 ext. 9585 fax: +64 9 441-8181 G.Kloss at massey.ac.nz http://www.massey.ac.nz/~gkloss From ceball at gmail.com Tue Jul 14 15:16:01 2009 From: ceball at gmail.com (Chris Ball) Date: Tue, 14 Jul 2009 13:16:01 +0000 (UTC) Subject: [Image-SIG] Problem with Image.resize() using nearest-neighbor resampling? Message-ID: Hi, I'd like to resize an image by scaling each of its pixels by the same factor. I've tried using Image.resize() with the filter set to NEAREST, but I find that the pixels in the original image do not all end up the same size in the new image. Do I have the wrong idea about what NEAREST does? Here is an example to demonstrate my problem (using numpy to avoid needing an image file, and to make it easier to show the results in text; you could instead use a 4x4 image and the .show() method of Image to see what I'm talking about): python> import Image,numpy python> a = numpy.array([[255,0,255,0],[0,255,0,255], ... [255,0,255,0],[0,255,0,255]],dtype=numpy.uint8) python> a array([[255, 0, 255, 0], [ 0, 255, 0, 255], [255, 0, 255, 0], [ 0, 255, 0, 255]], dtype=uint8) python> i=Image.fromarray(a) python> i2=i.resize((6*4,6*4),Image.NEAREST) I expected each pixel in i to have been enlarged to be 6x6 in i2, but that doesn't seem to have happened. Here is the first column of the image: python> numpy.array(i2)[:,0] array([255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0], dtype=uint8) Why hasn't each pixel been enlarged to have a side of length 6? The first pixel has been enlarged to have side of length 7, the next length 5, then 7, then 5. Thanks, Chris P.S. I'm using PIL 1.1.6. From seb.haase at gmail.com Tue Jul 14 15:37:56 2009 From: seb.haase at gmail.com (Sebastian Haase) Date: Tue, 14 Jul 2009 15:37:56 +0200 Subject: [Image-SIG] feature detection/location in images In-Reply-To: References: Message-ID: On Tue, Jul 14, 2009 at 5:31 AM, Kevin Cazabon wrote: > Hey everyone - does anyone have good experience in locating features in an > image? ?PilPlus used to have a "ImageCrackCode" module, but I've never used > it or even seen it (it says no longer available). > > I don't need to find _specific_ features, but need to find a small set of > distinct features consistently in similar images (for aligning them > together). ?I can brute-force this with min/max values/etc, but was hoping > for some help on something more elegant and efficient. ?Any pointers would > be appreciated, thanks! > Kevin, how would you feel about using numpy for this !? -- Sebastian Haase From a.cappelli at asidev.com Tue Jul 14 15:42:45 2009 From: a.cappelli at asidev.com (Andrea Cappelli) Date: Tue, 14 Jul 2009 15:42:45 +0200 Subject: [Image-SIG] Conversion from RGB to CMYK Message-ID: <1247578965.31408.16.camel@vulcan> Hi list, I'm a beginner with Python and I'm using PIL to convert a lot of images from RGB colorspace to CMYK in order to insert them in a catalogue to be printed by a typography i use the following piece of code handle = PIL.open(filePath).convert("CMYK") ## some stuff handle.save(newFilePath) Everything seems ok, except than when I see the generated result (i produce a pdf using reportlab) with Acrobat Pro the K layer of my images is empty. Every point of color in CMYK has the K value equal to 0. Seems that PIL convert RGB to CMY, ignoring the K value. This is true except for black images (RGB=0,0,0), that are mapped to (0,0,0,100) I'm sure this behaviour doesn't depends on Reportlba because if I load (with tha same code, trying to force colorspace to CMYK) images wich are already in CMYK (so no conversion occur) the are displayed fine This is a strange behaviour ora perhaps I'm wrong and I don't use correctly PIL? Thanks -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 197 bytes Desc: Questa ? una parte del messaggio firmata digitalmente URL: From fredrik at pythonware.com Tue Jul 14 16:12:33 2009 From: fredrik at pythonware.com (Fredrik Lundh) Date: Tue, 14 Jul 2009 16:12:33 +0200 Subject: [Image-SIG] Conversion from RGB to CMYK In-Reply-To: <1247578965.31408.16.camel@vulcan> References: <1247578965.31408.16.camel@vulcan> Message-ID: <368a5cd50907140712p12132013v49d4b96954a86ec3@mail.gmail.com> 2009/7/14 Andrea Cappelli : > I'm a beginner with Python and I'm using PIL to convert a lot of images > from RGB colorspace to CMYK in order to insert them in a catalogue to be > printed by a typography > > i use the following piece of code > > ? ? ? ?handle = PIL.open(filePath).convert("CMYK") > ? ? ? ?## some stuff > ? ? ? ?handle.save(newFilePath) > > Everything seems ok, except than when I see the generated result (i > produce a pdf using reportlab) with Acrobat Pro the K layer of my images > is empty. > > Every point of color in CMYK has the K value equal to 0. Seems that PIL > convert RGB to CMY, ignoring the K value. This is true except for black > images (RGB=0,0,0), that are mapped to (0,0,0,100) PIL's default conversion does the simplest thing possible; it doesn't handle color profiles, undercolor removal, etc. that you need to take into account if you're doing print stuff. You can use something like LittleCMS to do a better job (there's a binding included in the upcoming 1.1.7 release, available from hg.effbot.org and there's at least two separate Python bindings available as well). Alternatively, you could embed a color profile in your PDF files and leave the rest to Acrobat and the printer (I don't know how to do that with ReportLab, though). From SridharR at activestate.com Tue Jul 14 21:48:59 2009 From: SridharR at activestate.com (Sridhar Ratnakumar) Date: Tue, 14 Jul 2009 12:48:59 -0700 Subject: [Image-SIG] Suggestion to use tcl stubs when building PIL Message-ID: Hello there, Windows binaries for PIL provided at pythonware.com do not work on ActivePython 2.5.4.4. There was a bug reported here: http://bugs.activestate.com/show_bug.cgi?id=83694 This is because the PIL binaries are directly linked against tk84.dll, while the ActivePython installation comes with tk-8.5. Jeff Hobbs pointed out that using tcl stubs is the correct thing to do in order to ensure compatibility with different versions of Tcl/Tk libraries installed. Since this is not an issue with python.org's Python (whose 2.5 version comes with Tcl/Tk 8.4), I do not consider this a severe issue, however, having this fixed will at least make PIL work against some of the custom Python installations (of which ActivePython is just one of them). -srid From lubensch.proletariat.inc at gmail.com Tue Jul 14 19:05:54 2009 From: lubensch.proletariat.inc at gmail.com (Chris Ps) Date: Tue, 14 Jul 2009 20:05:54 +0300 Subject: [Image-SIG] feature detection/location in images Message-ID: > ---------- Forwarded message ---------- > From: Kevin Cazabon > To: image-sig at python.org > Date: Mon, 13 Jul 2009 23:31:14 -0400 > Subject: [Image-SIG] feature detection/location in images > Hey everyone - does anyone have good experience in locating features in an > image? PilPlus used to have a "ImageCrackCode" module, but I've never used > it or even seen it (it says no longer available). > > I don't need to find _specific_ features, but need to find a small set of > distinct features consistently in similar images (for aligning them > together). I can brute-force this with min/max values/etc, but was hoping > for some help on something more elegant and efficient. Any pointers would > be appreciated, thanks! > > Kevin. > > > > ---------- Forwarded message ---------- > From: "Guy K. Kloss" > To: image-sig at python.org > Date: Tue, 14 Jul 2009 16:37:21 +1200 > Subject: Re: [Image-SIG] feature detection/location in images > On Tue, 14 Jul 2009 15:31:14 Kevin Cazabon wrote: > > I don't need to find specific features, but need to find a small set > > of distinct features consistently in similar images (for aligning them > > together). I can brute-force this with min/max values/etc, but was > > hoping for some help on something more elegant and efficient. Any > > pointers would be appreciated, thanks! > > I've accomplished something similar using OpenCV functions that correlate a > template to an area and return a matrix of correlation ratings. Then > finding > in the matrix the extreme value (max or min depending on the function) you > can > find your "best match". > > Currently I'd advise the ctypes-opencv bindings by Minh-Tri Pham to use the > code from Python. It's quite speedy and works well, just need to play a bit > with the functions to find out which works best for your case. > > HTH, > > Guy > > -- > Guy K. Kloss > Institute of Information and Mathematical Sciences > Te Kura P?taiao o M?hiohio me P?ngarau > Massey University, Albany (North Shore City, Auckland) > 473 State Highway 17, Gate 1, Mailroom, Quad B Building > voice: +64 9 414-0800 ext. 9585 fax: +64 9 441-8181 > G.Kloss at massey.ac.nz http://www.massey.ac.nz/~gkloss > I would also recommend OpenCV. I'm not familiar with the bindings by Minh-Tri Pham, I'm using the Python(x,y) distribution which includes python bindings from the original c library. Some of the functions are buggy and the API is rather clumsy (very c like), but I don't think you will have a problem. In case the functions you are looking for don't exist in OpenCV a solution would be to export your PIL image as a nd array to numpy and work with that. Dealing with numpy makes repetitive window based operations faster than PIL. Christos -------------- next part -------------- An HTML attachment was scrubbed... URL: From michalswat at gmail.com Sat Jul 18 23:41:18 2009 From: michalswat at gmail.com (=?ISO-8859-2?Q?Micha=B3_Swat?=) Date: Sat, 18 Jul 2009 23:41:18 +0200 Subject: [Image-SIG] PIL thumbnail method Message-ID: <95bdd4b40907181441h1621dc0cj31dd4a30895a77db@mail.gmail.com> Hi, I think there is a bug in thumbnail() method in PIL library. In line 1533 is: self.size = size in my opinion this should be: self.size = im.size becouse now after calling thumbnail() method on an image object when I want get dimentions of image(size property) i still gets old values, exactly the same like before thumbnail() calls.Realy should be like that? Michal From efotinis at yahoo.com Sun Jul 19 09:21:30 2009 From: efotinis at yahoo.com (Elias Fotinis) Date: Sun, 19 Jul 2009 10:21:30 +0300 Subject: [Image-SIG] PIL thumbnail method In-Reply-To: <95bdd4b40907181441h1621dc0cj31dd4a30895a77db@mail.gmail.com> References: <95bdd4b40907181441h1621dc0cj31dd4a30895a77db@mail.gmail.com> Message-ID: <70C9EC4BE6754FE2BE2E9245ACA8CD1E@efcore> 'size' already contains the thumbnail dimensions (set in line 1515), so I get the correct behavior here. Are you perhaps using an older buggy library? 1.1.6 is the current stable and 1.1.7 is in the works. ----- Original Message ----- From: "Micha? Swat" To: Sent: Sunday, July 19, 2009 00:41 Subject: [Image-SIG] PIL thumbnail method > Hi, I think there is a bug in thumbnail() method in PIL library. > In line 1533 is: > self.size = size > > in my opinion this should be: > > self.size = im.size > > becouse now after calling thumbnail() method on an image object when I > want get dimentions of image(size property) i still gets old values, > exactly the same like before thumbnail() calls.Realy should be like > that? > > Michal > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig From pil at flynnux.de Wed Jul 22 11:34:48 2009 From: pil at flynnux.de (Flynn Marquardt) Date: Wed, 22 Jul 2009 11:34:48 +0200 Subject: [Image-SIG] Patch: Better compression of png-images Message-ID: <1248255288.4255.20.camel@tablet.flynnux.de> Hi, the achieved compression rates of png images created by python-imaging are really bad, programs like optipng or pncrush can compress these images much better, often only to 30-50% of the size generated by pil. Looking into the code I found these lines in libImaging/ZipEncode.c: // err = deflate(&context->z_stream, Z_NO_FLUSH); /* FIXME: temporary workaround for problem with recent versions of zlib -- 990709/fl */ err = deflate(&context->z_stream, Z_SYNC_FLUSH); Reverting this to: err = deflate(&context->z_stream, Z_NO_FLUSH); /* FIXME: temporary workaround for problem with recent versions of zlib -- 990709/fl */ // err = deflate(&context->z_stream, Z_SYNC_FLUSH); improves the compression (close) to the desired optimum. I think the mentioned bug in zlib is fixed, it is ten years ago. For me it works fine, can somebody who understands more of this topic, confirm this? Flynn From kevin at cazabon.com Wed Jul 15 03:40:23 2009 From: kevin at cazabon.com (Kevin Cazabon) Date: Tue, 14 Jul 2009 21:40:23 -0400 Subject: [Image-SIG] feature detection/location in images In-Reply-To: References: Message-ID: Thanks for the input everyone - I'll check it out. Hopefully it's easy to get set up and working. Kevin. On 14 Jul 2009, at 13:05, Chris Ps wrote: > > ---------- Forwarded message ---------- > From: Kevin Cazabon > To: image-sig at python.org > Date: Mon, 13 Jul 2009 23:31:14 -0400 > Subject: [Image-SIG] feature detection/location in images > Hey everyone - does anyone have good experience in locating features > in an image? PilPlus used to have a "ImageCrackCode" module, but > I've never used it or even seen it (it says no longer available). > > I don't need to find _specific_ features, but need to find a small > set of distinct features consistently in similar images (for > aligning them together). I can brute-force this with min/max values/ > etc, but was hoping for some help on something more elegant and > efficient. Any pointers would be appreciated, thanks! > > Kevin. > > > > ---------- Forwarded message ---------- > From: "Guy K. Kloss" > To: image-sig at python.org > Date: Tue, 14 Jul 2009 16:37:21 +1200 > Subject: Re: [Image-SIG] feature detection/location in images > On Tue, 14 Jul 2009 15:31:14 Kevin Cazabon wrote: > > I don't need to find specific features, but need to find a small set > > of distinct features consistently in similar images (for aligning > them > > together). I can brute-force this with min/max values/etc, but was > > hoping for some help on something more elegant and efficient. Any > > pointers would be appreciated, thanks! > > I've accomplished something similar using OpenCV functions that > correlate a > template to an area and return a matrix of correlation ratings. Then > finding > in the matrix the extreme value (max or min depending on the > function) you can > find your "best match". > > Currently I'd advise the ctypes-opencv bindings by Minh-Tri Pham to > use the > code from Python. It's quite speedy and works well, just need to > play a bit > with the functions to find out which works best for your case. > > HTH, > > Guy > > -- > Guy K. Kloss > Institute of Information and Mathematical Sciences > Te Kura P?taiao o M?hiohio me P?ngarau > Massey University, Albany (North Shore City, Auckland) > 473 State Highway 17, Gate 1, Mailroom, Quad B Building > voice: +64 9 414-0800 ext. 9585 fax: +64 9 441-8181 > G.Kloss at massey.ac.nz http://www.massey.ac.nz/~gkloss > > I would also recommend OpenCV. I'm not familiar with the bindings by > Minh-Tri Pham, I'm using the Python(x,y) distribution which includes > python bindings from the original c library. Some of the functions > are buggy and the API is rather clumsy (very c like), but I don't > think you will have a problem. In case the functions you are looking > for don't exist in OpenCV a solution would be to export your PIL > image as a nd array to numpy and work with that. Dealing with numpy > makes repetitive window based operations faster than PIL. > > Christos > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig -------------- next part -------------- An HTML attachment was scrubbed... URL: From remi_inconnu at yahoo.fr Sat Jul 18 12:10:03 2009 From: remi_inconnu at yahoo.fr (=?iso-8859-1?Q?R=E9mi_inconnu?=) Date: Sat, 18 Jul 2009 10:10:03 +0000 (GMT) Subject: [Image-SIG] GbrImagePlugin.py source file updated for the Gimp 2.6.6 version Message-ID: <806139.89620.qm@web26304.mail.ukl.yahoo.com> Hello, I have patched PIL to support the new gimp brush file. I attach the file modified to this mail. Best regards. R?mi -------------- next part -------------- A non-text attachment was scrubbed... Name: GbrImagePlugin.py Type: application/x-download Size: 2463 bytes Desc: not available URL: From gjhames at gmail.com Mon Jul 20 18:48:27 2009 From: gjhames at gmail.com (Gewton Jhames) Date: Mon, 20 Jul 2009 13:48:27 -0300 Subject: [Image-SIG] TIFF Manipulation Message-ID: <23bdbe700907200948j6c45d71eg71910ccf077aef10@mail.gmail.com> Hello everyone, I just want to load a TIFF image, append another image (TIFF or not) on that, and save. I have read the documentation, and I didn't find any example on how to append an image to a TIFF. THanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mark at nextra.sk Sun Jul 26 10:01:01 2009 From: mark at nextra.sk (Mark) Date: Sun, 26 Jul 2009 10:01:01 +0200 Subject: [Image-SIG] support for python 3 Message-ID: <924502674.20090726100101@nextra.sk> Hello, I'd like to ask when PIL plans to support for Python 3? Thanks in advance for the information, Mark From snaury at gmail.com Mon Jul 27 13:10:34 2009 From: snaury at gmail.com (Alexey Borzenkov) Date: Mon, 27 Jul 2009 15:10:34 +0400 Subject: [Image-SIG] Suggestion to use tcl stubs when building PIL In-Reply-To: References: Message-ID: On Tue, Jul 14, 2009 at 11:48 PM, Sridhar Ratnakumar wrote: > Jeff Hobbs pointed out that using tcl stubs is the correct thing to do in > order to ensure compatibility with different versions of Tcl/Tk libraries > installed. Since this is not an issue with python.org's Python (whose 2.5 > version comes with Tcl/Tk 8.4), I do not consider this a severe issue, > however, having this fixed will at least make PIL work against some of the > custom Python installations (of which ActivePython is just one of them). Actually, good idea. Here's a patch: http://git.kitsu.ru/patched/pil.git?a=commitdiff;h=34b332238afbdd22a27f9e66905df60f8856e74c (just ignore setup-df-mingw.py and setup-df.py) Or here, if gmail doesn't screw it up: diff --git a/Tk/tkImaging.c b/Tk/tkImaging.c index 5e37d05..3ddace5 100644 --- a/Tk/tkImaging.c +++ b/Tk/tkImaging.c @@ -240,6 +240,12 @@ PyImagingPhotoGet(ClientData clientdata, Tcl_Interp* interp, void TkImaging_Init(Tcl_Interp* interp) { +#ifdef USE_TCL_STUBS + Tcl_InitStubs(interp, TCL_VERSION, 0); +#endif +#ifdef USE_TK_STUBS + Tk_InitStubs(interp, TK_VERSION, 0); +#endif Tcl_CreateCommand(interp, "PyImagingPhoto", PyImagingPhotoPut, (ClientData) 0, (Tcl_CmdDeleteProc*) NULL); Tcl_CreateCommand(interp, "PyImagingPhotoGet", PyImagingPhotoGet, diff --git a/setup.py b/setup.py index aee3d2d..2a64576 100644 --- a/setup.py +++ b/setup.py @@ -211,6 +211,7 @@ class pil_build_ext(build_ext): class feature: zlib = jpeg = tiff = freetype = tcl = tk = None + tclstub = tkstub = False feature = feature() if find_library_file(self, "z"): @@ -250,11 +251,23 @@ class pil_build_ext(build_ext): if _tkinter: # the library names may vary somewhat (e.g. tcl84 or tcl8.4) version = TCL_VERSION[0] + TCL_VERSION[2] - if find_library_file(self, "tcl" + version): + if find_library_file(self, "tclstub" + version): + feature.tcl = "tclstub" + version + feature.tclstub = True + elif find_library_file(self, "tclstub" + TCL_VERSION): + feature.tcl = "tclstub" + TCL_VERSION + feature.tclstub = True + elif find_library_file(self, "tcl" + version): feature.tcl = "tcl" + version elif find_library_file(self, "tcl" + TCL_VERSION): feature.tcl = "tcl" + TCL_VERSION - if find_library_file(self, "tk" + version): + if find_library_file(self, "tkstub" + version): + feature.tk = "tkstub" + version + feature.tkstub = True + elif find_library_file(self, "tkstub" + TCL_VERSION): + feature.tk = "tkstub" + TCL_VERSION + feature.tkstub = True + elif find_library_file(self, "tk" + version): feature.tk = "tk" + version elif find_library_file(self, "tk" + TCL_VERSION): feature.tk = "tk" + TCL_VERSION @@ -326,9 +339,15 @@ class pil_build_ext(build_ext): )) feature.tcl = feature.tk = 1 # mark as present elif feature.tcl and feature.tk: + tkdefs = [] + if feature.tclstub: + tkdefs.append(("USE_TCL_STUBS",None)) + if feature.tkstub: + tkdefs.append(("USE_TK_STUBS",None)) exts.append(Extension( "_imagingtk", ["_imagingtk.c", "Tk/tkImaging.c"], - libraries=[feature.tcl, feature.tk] + libraries=[feature.tcl, feature.tk], + define_macros=tkdefs )) if os.path.isfile("_imagingmath.c"): From snaury at gmail.com Mon Jul 27 15:08:10 2009 From: snaury at gmail.com (Alexey Borzenkov) Date: Mon, 27 Jul 2009 17:08:10 +0400 Subject: [Image-SIG] Patch: Better compression of png-images In-Reply-To: <1248255288.4255.20.camel@tablet.flynnux.de> References: <1248255288.4255.20.camel@tablet.flynnux.de> Message-ID: On Wed, Jul 22, 2009 at 1:34 PM, Flynn Marquardt wrote: > Reverting this to: > > ? ? ? ? ? ? ? ?err = deflate(&context->z_stream, Z_NO_FLUSH); > > ? ? ? ? ? ? ? ?/* FIXME: temporary workaround for problem with recent > ? ? ? ? ? ? ? ? ? versions of zlib -- 990709/fl */ > > ? ? ? ? ? ? ? ?// err = deflate(&context->z_stream, Z_SYNC_FLUSH); > > improves the compression (close) to the desired optimum. I think the > mentioned bug in zlib is fixed, it is ten years ago. No, it appears it is not. I tried working with PIL compiled with Z_NO_FLUSH and several hours later I found that it rarely generates corrupt png images. And this is with zlib 1.2.3, so it appears it is either not fixed, or there is something else going on... From snaury at gmail.com Mon Jul 27 15:52:31 2009 From: snaury at gmail.com (Alexey Borzenkov) Date: Mon, 27 Jul 2009 17:52:31 +0400 Subject: [Image-SIG] Patch: Better compression of png-images In-Reply-To: <1248255288.4255.20.camel@tablet.flynnux.de> References: <1248255288.4255.20.camel@tablet.flynnux.de> Message-ID: Hi again, I found what was the real problem with Z_NO_FLUSH. The code was only checking that it ran out of output buffer, but when it does it can usually mean that not all input was deflated. However, when it enters ZipEncode next time, the data that was not deflated in the previous round is forgotten and discarded (by overwriting next_in), thus it was making holes in dicompressed data, which turned into corrupt png images. The following patch (I hope) fixes it properly: http://git.kitsu.ru/patched/pil.git?a=commitdiff;h=3f199f00ec63237ad3bf2d8895a2e16605c8c08a diff --git a/libImaging/ZipEncode.c b/libImaging/ZipEncode.c index 11e000c..e2480d3 100644 --- a/libImaging/ZipEncode.c +++ b/libImaging/ZipEncode.c @@ -69,6 +69,8 @@ ImagingZipEncode(Imaging im, ImagingCodecState state, UINT8* buf, int bytes) context->z_stream.zalloc = (alloc_func)0; context->z_stream.zfree = (free_func)0; context->z_stream.opaque = (voidpf)0; + context->z_stream.next_in = 0; + context->z_stream.avail_in = 0; err = deflateInit2(&context->z_stream, /* compression level */ @@ -103,6 +105,27 @@ ImagingZipEncode(Imaging im, ImagingCodecState state, UINT8* buf, int bytes) /* Setup the destination buffer */ context->z_stream.next_out = buf; context->z_stream.avail_out = bytes; + if (context->z_stream.next_in && context->z_stream.avail_in > 0) { + /* We have some data from previous round, deflate it first */ + err = deflate(&context->z_stream, Z_NO_FLUSH); + + if (err < 0) { + /* Something went wrong inside the compression library */ + if (err == Z_DATA_ERROR) + state->errcode = IMAGING_CODEC_BROKEN; + else if (err == Z_MEM_ERROR) + state->errcode = IMAGING_CODEC_MEMORY; + else + state->errcode = IMAGING_CODEC_CONFIG; + free(context->paeth); + free(context->average); + free(context->up); + free(context->prior); + free(context->previous); + deflateEnd(&context->z_stream); + return -1; + } + } for (;;) { @@ -237,12 +260,7 @@ ImagingZipEncode(Imaging im, ImagingCodecState state, UINT8* buf, int bytes) context->z_stream.next_in = context->output; context->z_stream.avail_in = state->bytes+1; - /* err = deflate(&context->z_stream, Z_NO_FLUSH); */ - - /* FIXME: temporary workaround for problem with recent - versions of zlib -- 990709/fl */ - - err = deflate(&context->z_stream, Z_SYNC_FLUSH); + err = deflate(&context->z_stream, Z_NO_FLUSH); if (err < 0) { /* Something went wrong inside the compression library */ From pil at flynnux.de Tue Jul 28 12:16:42 2009 From: pil at flynnux.de (Flynn Marquardt) Date: Tue, 28 Jul 2009 12:16:42 +0200 Subject: [Image-SIG] Patch: Better compression of png-images In-Reply-To: References: <1248255288.4255.20.camel@tablet.flynnux.de> Message-ID: <1248776202.12732.32.camel@tablet.flynnux.de> Am Montag, den 27.07.2009, 17:52 +0400 schrieb Alexey Borzenkov: > Hi again, > > I found what was the real problem with Z_NO_FLUSH. The code was only > checking that it ran out of output buffer, but when it does it can > usually mean that not all input was deflated. However, when it enters > ZipEncode next time, the data that was not deflated in the previous > round is forgotten and discarded (by overwriting next_in), thus it was > making holes in dicompressed data, which turned into corrupt png > images. The following patch (I hope) fixes it properly: > I never got corrupt images, but I applied the attached patch anyway. It seems to work and I hope this will go upstream. Thanks Flynn P.S.: There is another size bloating feature in PIL: all palettes are stored full size (usually 256 entries) instead only storing the real used colors. This especially is a problem with pictures with only a few colors, where then the palette is much bigger than the compressed data. Do you see any chance to fix this? I took alook, but it seems not so easy. From snaury at gmail.com Tue Jul 28 22:11:12 2009 From: snaury at gmail.com (Alexey Borzenkov) Date: Wed, 29 Jul 2009 00:11:12 +0400 Subject: [Image-SIG] Patch: Better compression of png-images In-Reply-To: <1248776202.12732.32.camel@tablet.flynnux.de> References: <1248255288.4255.20.camel@tablet.flynnux.de> <1248776202.12732.32.camel@tablet.flynnux.de> Message-ID: On Tue, Jul 28, 2009 at 2:16 PM, Flynn Marquardt wrote: > I never got corrupt images, but I applied the attached patch anyway. Well, it seemed that the bigger the image, the bigger the chance for corruption. In my case (with images 800x600 and the like in size) it was something like 2 corrupted images out of 20. I didn't even attribute it to Z_NO_FLUSH at first, thinking there was strange problems in my conversion logic, until I saw that ACDSee was saying "corrupt image" in the status bar. > P.S.: There is another size bloating feature in PIL: all palettes are > stored full size (usually 256 entries) instead only storing the real > used colors. This especially is a problem with pictures with only a few > colors, where then the palette is much bigger than the compressed data. > > Do you see any chance to fix this? I took alook, but it seems not so > easy. Well, it certainly doesn't affect me. :) 1.1.6 doesn't seem to support partial palettes anyway, you can only assign all 256 colors, and remapping colors would be crazy (since I use PIL for game localizations mostly, I often need the *exact* palette [which is often separate and shared among several images in the game], and wouldn't want PIL to do anything fancy with it). Besides, that's under 1k anyway, you should definitely use pngcrush if sizes like that matter to you. From pil at flynnux.de Wed Jul 29 08:05:04 2009 From: pil at flynnux.de (Flynn Marquardt) Date: Wed, 29 Jul 2009 08:05:04 +0200 Subject: [Image-SIG] Patch: Better compression of png-images In-Reply-To: References: <1248255288.4255.20.camel@tablet.flynnux.de> <1248776202.12732.32.camel@tablet.flynnux.de> Message-ID: <1248847504.12732.49.camel@tablet.flynnux.de> Am Mittwoch, den 29.07.2009, 00:11 +0400 schrieb Alexey Borzenkov: > On Tue, Jul 28, 2009 at 2:16 PM, Flynn Marquardt wrote: > > I never got corrupt images, but I applied the attached patch anyway. > > Well, it seemed that the bigger the image, the bigger the chance for > corruption. In my case (with images 800x600 and the like in size) it > was something like 2 corrupted images out of 20. I didn't even > attribute it to Z_NO_FLUSH at first, thinking there was strange > problems in my conversion logic, until I saw that ACDSee was saying > "corrupt image" in the status bar. > OK, that's the difference, I only produce pictures of 256x256 pixels (tiles of a map). so I never run into this ... > > P.S.: There is another size bloating feature in PIL: all palettes are > > stored full size (usually 256 entries) instead only storing the real > > used colors. This especially is a problem with pictures with only a few > > colors, where then the palette is much bigger than the compressed data. > > > > Do you see any chance to fix this? I took alook, but it seems not so > > easy. > > Well, it certainly doesn't affect me. :) 1.1.6 doesn't seem to support > partial palettes anyway, you can only assign all 256 colors, and > remapping colors would be crazy (since I use PIL for game > localizations mostly, I often need the *exact* palette [which is often > separate and shared among several images in the game], and wouldn't > want PIL to do anything fancy with it). Besides, that's under 1k > anyway, you should definitely use pngcrush if sizes like that matter > to you. I'm only talking about pictures, that really have only a few different colors in it. In the file PIL/PngImagePlugin.py the size is hard coded to # # attempt to minimize storage requirements for palette images if im.encoderinfo.has_key("bits"): # number of bits specified by user n = 1 << im.encoderinfo["bits"] else: # check palette contents n = 256 # FIXME 256 entries, and in libImaging/Quant.c the palette ist forced to have 256 entries: for (i = j = 0; i < (int) paletteLength; i++) { *pp++ = palette[i].c.r; *pp++ = palette[i].c.g; *pp++ = palette[i].c.b; *pp++ = 255; } for (; i < 256; i++) { *pp++ = 0; *pp++ = 0; *pp++ = 0; *pp++ = 255; } Also I'm confused about the different methods for palettes: im.palette im.im.getpalette I was not able to produce a patch, that fixes both. The second e.g. is used in the png-plugin. From snaury at gmail.com Wed Jul 29 11:13:02 2009 From: snaury at gmail.com (Alexey Borzenkov) Date: Wed, 29 Jul 2009 13:13:02 +0400 Subject: [Image-SIG] ImageFile._ParserFile Message-ID: Hi all, I've been looking at ImageFile._ParserFile (used by ImageFile.Parser), and suddenly thought that all it does is reimplement reading part of StringIO. Why is it needed? Of course using StringIO.StringIO wouldn't make much sense in terms of performance/etc, but cStringIO.StringIO (with the usual try/except) might make sense. What do you think? From michele.petrazzo at unipex.it Wed Jul 29 14:18:46 2009 From: michele.petrazzo at unipex.it (Michele Petrazzo - Unipex) Date: Wed, 29 Jul 2009 14:18:46 +0200 Subject: [Image-SIG] TIFF Manipulation In-Reply-To: <23bdbe700907200948j6c45d71eg71910ccf077aef10@mail.gmail.com> References: <23bdbe700907200948j6c45d71eg71910ccf077aef10@mail.gmail.com> Message-ID: <4A703E26.7040801@unipex.it> Gewton Jhames wrote: > Hello everyone, Hi, > I just want to load a TIFF image, append another image (TIFF or not) > on that, and save. I have read the documentation, and I didn't find > any example on how to append an image to a TIFF. Like now I don't know you can append new images to a multi-page image with pil... You can use tiffcp, convert or other tools (all the OS has open-source programs that can help you) or you can use freeimagepy that can do your work, using always python. > THanks. Michele From michele.petrazzo at unipex.it Wed Jul 29 14:21:14 2009 From: michele.petrazzo at unipex.it (Michele Petrazzo - Unipex) Date: Wed, 29 Jul 2009 14:21:14 +0200 Subject: [Image-SIG] support for python 3 In-Reply-To: <924502674.20090726100101@nextra.sk> References: <924502674.20090726100101@nextra.sk> Message-ID: <4A703EBA.9080204@unipex.it> Mark wrote: > Hello, > > I'd like to ask when PIL plans to support for Python 3? > http://effbot.org/zone/pil-index.htm > Thanks in advance for the information, > > Mark > P.s. For those interested, I have just release a new freeimagepy version (2.0.1, available only via svn due to a sf.net problem :( ) that support python 3.+ Michele From gary.capell at gmail.com Mon Jul 27 08:59:45 2009 From: gary.capell at gmail.com (Gary Capell) Date: Mon, 27 Jul 2009 16:59:45 +1000 Subject: [Image-SIG] Problem with Image.resize() using nearest-neighbor resampling? Message-ID: See http://mail.python.org/pipermail/image-sig/2009-July/005790.html I noticed the same problem. My workaround was to use: numpy.asarray(img).reshape(1, scale_x).reshape(0, scale_y) (in case that helps anyone). -------------- next part -------------- An HTML attachment was scrubbed... URL: From gary.capell at gmail.com Mon Jul 27 09:08:16 2009 From: gary.capell at gmail.com (Gary Capell) Date: Mon, 27 Jul 2009 17:08:16 +1000 Subject: [Image-SIG] problem with numpy.asarray and PIL Message-ID: I get this problem (with python2.6, PIL 1.1.6, numpy 1.3.0 ) >>> from PIL import Image >>> import numpy >>> i = Image.open('chart_bl.tif') >>> a = numpy.asarray(i) >>> o.size, a.shape ((13228, 18710), (18710, 13228)) >>> o.size, a.shape, a.dtype ((13228, 18710), (18710, 13228), dtype('bool')) >>> numpy.histogram(a) Segmentation fault I'm very happy to send the offending image to anyone who is interested in chasing this down: it is only 2.3KB as a .tif.bz2 file. -------------- next part -------------- An HTML attachment was scrubbed... URL: From tejovathi.p at gmail.com Mon Jul 27 16:52:35 2009 From: tejovathi.p at gmail.com (Tejovathi P) Date: Mon, 27 Jul 2009 15:52:35 +0100 Subject: [Image-SIG] Regarding image compression Message-ID: Hi All, I have a JPEG image of size 25KB and I want to compress it to 15KB, But I want to keep the original height and width same and reduce the size of the image. Is there any easy way to achieve this? Please let me know. Thanks, Teja -------------- next part -------------- An HTML attachment was scrubbed... URL: From gutiers at plattsburgh.edu Mon Jul 27 18:15:32 2009 From: gutiers at plattsburgh.edu (Salvador Gutierrez) Date: Mon, 27 Jul 2009 12:15:32 -0400 (EDT) Subject: [Image-SIG] Build of 1.1.6 fails Message-ID: <50733.96.228.116.60.1248711332.squirrel@webmail.plattsburgh.edu> Hi, 1. I have python2.5 in my system but it was not built from source, so Python.h does not exist and the compile fails. 2. I have python3.1 also in my system (this one was built from source), so Python.h exists but then the script calls for python2.5 and the compile fails. What shall I do? Can I edit the build script to use 3.1 instead of 2.5, or is it better to just copy Python.h to the expected location and use the provided script? Thank you, -- Salvador Jes?s Guti?rrez Mart?nez SUNY-Plattsburgh 101 Broad St., Plattsburgh, NY 12901 Tel. (518) 564-2778 Fax (518) 564-3010 Web: http://www.cs.plattsburgh.edu/~salvador/ From gjhames at gmail.com Wed Jul 29 14:54:56 2009 From: gjhames at gmail.com (Gewton Jhames) Date: Wed, 29 Jul 2009 09:54:56 -0300 Subject: [Image-SIG] TIFF Manipulation In-Reply-To: <4A703E26.7040801@unipex.it> References: <23bdbe700907200948j6c45d71eg71910ccf077aef10@mail.gmail.com> <4A703E26.7040801@unipex.it> Message-ID: <23bdbe700907290554q5cb5cd08ne5eeaee606b00095@mail.gmail.com> Hello Michele, thanks for help. I'll check out this others libraries. Thanks. On Wed, Jul 29, 2009 at 9:18 AM, Michele Petrazzo - Unipex < michele.petrazzo at unipex.it> wrote: > Gewton Jhames wrote: > >> Hello everyone, >> > > Hi, > > I just want to load a TIFF image, append another image (TIFF or not) on >> that, and save. I have read the documentation, and I didn't find any example >> on how to append an image to a TIFF. >> > > Like now I don't know you can append new images to a multi-page image > with pil... You can use tiffcp, convert or other tools (all the OS has > open-source programs that can help you) or you can use freeimagepy that > can do your work, using always python. > > THanks. >> > > Michele > -------------- next part -------------- An HTML attachment was scrubbed... URL: From miltinho.astronauta at gmail.com Wed Jul 29 16:14:23 2009 From: miltinho.astronauta at gmail.com (Milton Cezar Ribeiro) Date: Wed, 29 Jul 2009 10:14:23 -0400 Subject: [Image-SIG] reading and display .asc raster files. Message-ID: <64f1583f0907290714v259479a4t70ef1c281cae7cd6@mail.gmail.com> Dear all, I am a newbie with image/gis reading on Python. Is there a way (a library?) of I read .asc files and display it on python? This extension of files are common for ESRI exchange raster format. Unfortunately I am not able to install PROJ4, GDAL or GRASS on this machine, because it is running linux/debian in a university I and can't have help with system manager on this moment. Any help are welcome. cheers milton brazil=toronto -------------- next part -------------- An HTML attachment was scrubbed... URL: From miltinho.astronauta at gmail.com Wed Jul 29 19:09:46 2009 From: miltinho.astronauta at gmail.com (Milton Cezar Ribeiro) Date: Wed, 29 Jul 2009 13:09:46 -0400 Subject: [Image-SIG] define color for imagem from matrix. Message-ID: <64f1583f0907291009s1800db1bkab610db6145e85ce@mail.gmail.com> Dear all, I read a matrix (with values from 0 to 4), converted it to image and showed it using: landscape_matrix=[[1, 2, 0, 1, 0], [1, 0, 1, 2, 0], [1, 1, 4, 2, 1], [1, 0, 3, 2, 2]] a = numpy.array(landscape_matrix) i = Image.fromarray(a) i.show() But now I need to define a color table like #index of color, R, G, B 0 255 255 255 1 127 127 0 2 127 0 127 3 255 0 0 4 0 255 0 How can I assign this color table to my image? Bests milton -------------- next part -------------- An HTML attachment was scrubbed... URL: