From michele.petrazzo at unipex.it Wed May 2 09:43:48 2007 From: michele.petrazzo at unipex.it (Michele Petrazzo - Unipex srl) Date: Wed, 02 May 2007 09:43:48 +0200 Subject: [Image-SIG] seeking guidance on image conversion In-Reply-To: References: <461B5C49.8080307@unipex.it> Message-ID: <46384134.2050402@unipex.it> Brad Allen wrote: > At 11:43 AM +0200 4/10/07, Michele Petrazzo - Unipex srl wrote: >> A solution can be that already replied. Another can be to use >> freeimagepy that is born because PIL doesn't handle, like I need, >> the g3, g4 and multipage tiff files. I create it, and I use it, for >> hylapex, a fax client that need to work with fax files, that are >> in g3 and g4 format! My old solution, like you wrote, was use the >> tiff gnuwin32 files, but work with a dll a some python (ctypes) >> code, are better! :) > > Sorry for the delayed reply. No problem. > That sounds interesting Michele; can you show me any source code > examples of what you did with ctypes? google for freeimagepy and you'll see freeimagepy.sf.net -> examples -> (a very simple example. You'll find all the multipage examples on the site or on the package) import FreeImagePy as FIPY F = FIPY.Image("image.tiff") F.save("image.png") > Did you use ctypes with gnuwin32 or with some other dll? I call directly the freeimage dll (os .so un linux, since it are multiplatform) with ctypes. All the info and the download are on the internet site. If you have more question, ask me directly. Michele From michele.petrazzo at unipex.it Wed May 2 20:24:29 2007 From: michele.petrazzo at unipex.it (Michele Petrazzo - Unipex srl) Date: Wed, 02 May 2007 20:24:29 +0200 Subject: [Image-SIG] writing text on image In-Reply-To: References: Message-ID: <4638D75D.5070001@unipex.it> SELMA G?ZEL wrote: > Hi! > > According to my knowledge, PIL image module hasn't got text feature. > The Image module of PIL not, but the ImageDraw yes. Take a look at PIL website. > How can write text to an image? > There are several examples for do it > And another question, how can use enter feature when i want to write > to an image file? I want to write the result of > TextCalendar.formatmonth function, but the result is not > multi-line.Only one row.How can i correct? > What are "enter feature?" And what's the TextCalendar.formatmonth ? I haven't TextCalendar into my python installation. What do you want to do? What text do you have and how and where do you want to write it? > Thanks and regards... > Michele -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3273 bytes Desc: S/MIME Cryptographic Signature Url : http://mail.python.org/pipermail/image-sig/attachments/20070502/6dd3e5b2/attachment.bin From michele.petrazzo at unipex.it Wed May 2 20:37:03 2007 From: michele.petrazzo at unipex.it (Michele Petrazzo - Unipex srl) Date: Wed, 02 May 2007 20:37:03 +0200 Subject: [Image-SIG] calendar program using images In-Reply-To: References: Message-ID: <4638DA4F.8050609@unipex.it> SELMA G?ZEL wrote: > Hi! (May be, you can think that the question is long a bit, but > please read.Because i'm very bored ) I want to prepare a calendar > with images like this format: <-cut-> Sorry, but we don't know anything about your program! You are talking about some "TextCalendar.formatmonth" and so on. And without some code where read what do you want to do... How can we help you? > Or have you got any other, better idea for this program? > > In fact, first I did this like this: I used labels for all the months > and images on a label.But the problem was printing this form.I used > ImageGrab(bbox) function.But I didn't adjust the ares ofthe > button.How can i adjust? > What are your GUI lib? Say us all! > Thanks and regards!.. > Michele -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3273 bytes Desc: S/MIME Cryptographic Signature Url : http://mail.python.org/pipermail/image-sig/attachments/20070502/b58d4cab/attachment-0001.bin From roman at netangels.ru Fri May 4 11:47:46 2007 From: roman at netangels.ru (Roman Imankulov) Date: Fri, 04 May 2007 15:47:46 +0600 Subject: [Image-SIG] PNG Support with Parsed images. In-Reply-To: References: Message-ID: <463B0142.4060800@netangels.ru> Hi Dennis Muhlestein wrote: > If I load a png file with Image.open, I can manipulate it, save it > etc. If I however use ImageFile.Parser(), I can read the size, format > and any info, but I can't show or manipulate the image in any way. > > .... > > This is with version 1.1.6. I double checked 1.1.5 and got the same thing. > > This works fine with a JPEG image. The PNG support appears to have a > bug to me, but perhaps I'm missing something. > > Thanks > Dennis > I've got exactly same PNG bug with PIL 1.1.5 and 1.1.6. Does anybody know any solution or workaround? My sample session looks like this: >>> import ImageFile >>> p = ImageFile.Parser() >>> fd = open('file.png') >>> data = fd.read() >>> fd.close() >>> data '\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x01\x00\x00\x00\x01\x08\x03\x00\x00\x00(\xcb4\xbb\x00\x00\x00\x03PLTE\xff\xff\xff\xa7\xc4\x1b\xc8\x00\x00\x00\nIDAT\x08\x99c`\x00\x00\x00\x02\x00\x01\xf4qd\xa6\x00\x00\x00\x00IEND\xaeB`\x82' >>> p.feed(data) >>> im = p.close() >>> im >>> im.load() Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.4/site-packages/PIL/ImageFile.py", line 189, in load s = read(self.decodermaxblock) File "/usr/lib/python2.4/site-packages/PIL/PngImagePlugin.py", line 365, in load_read return self.fp.read(bytes) File "/usr/lib/python2.4/site-packages/PIL/ImageFile.py", line 298, in read data = self.data[pos:pos+bytes] TypeError: unsubscriptable object Thank you -- roman at netangels.ru From Jim.Vickroy at noaa.gov Wed May 2 17:45:24 2007 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Wed, 02 May 2007 09:45:24 -0600 Subject: [Image-SIG] writing text on image In-Reply-To: References: Message-ID: <4638B214.9060604@noaa.gov> SELMA G?ZEL wrote: > > Hi! > > According to my knowledge, PIL image module hasn't got text feature. > > How can write text to an image? > Take a look at the "text" method in http://www.pythonware.com/library/pil/handbook/imagedraw.htm > And another question, how can use enter feature when i want to write > to an image file?I want to write the result of > TextCalendar.formatmonth function, but the result is not > multi-line.Only one row.How can i correct? > > Thanks and regards... > > > > ------------------------------------------------------------------------ > Bilgisayardan bilgisayara ?cretsiz arama yap?n! Problem olmadan! > buray? t?klay?n! > ------------------------------------------------------------------------ > > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20070502/68a88131/attachment.htm From nate at deltateck.com Fri May 4 23:47:39 2007 From: nate at deltateck.com (Nate Jennings) Date: Fri, 4 May 2007 14:47:39 -0700 Subject: [Image-SIG] working with multi-spectral imagery, PIL, and NumPy Message-ID: <4f44d320705041447j3898ae93se949d740c8d7b7a1@mail.gmail.com> Hello... I am working on building an image processing application for a class I am teaching in remote sensing. I have multi-spectral (multi-band...greater than 3 bands of imagery) that I would like to load into a NumPy array so I can process it. PIL seems to be limited to 3 bands for PIL. Is there any other methods using PIL, NumPy, or other to work with more than 3 bands? The file format I am working with is TIF. The data is often from satellites (Landsat, SPOT, RADAR) or hyperspectral. I would like to do pixel processing such as custom filters that are not found in PIL, band ratios, image enhancements such as Principle Components, and image classification (such as maximum likelihood, or ISOData (unsupervised classification). Many of these functions require linear algebra, trigonometry functions, and statistics (the use of means, st deviations, histograms, etc) as well as 3x3, 5x5, or greater kernels (i.e. moving windows). >From my research there seems to be some work out there regarding 3 band images, performance testing for PIL and C routines, some basic filtering functions and kernel use. My work is related to remote sensing and GIS. Yes, I know about GRASS, but this is too complicated for my students who know very little about remote sensing and GIS. It looks like QGIS and GRASS have some integration, but it is still too cumbersome for novice users. I have been through a remote sensing algorithms class in grad school and I have fundamental knowledge of the math and programming logic. I am just trying to get it to work with Python, wxPython interface building, PIL, NumPy, and anything else I may need. Trying to communicate Python to C++ is beyond my capability without any serious documentation or samples to work from. I know C++, but it has been over 10 year since I programmed in this and it was done in OS2. Please provide me with links, sample code, and/or contacts to follow up with. Thank you in advance with any information. Nate -- http://www.jenningsplanet.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20070504/16763a8a/attachment.html From bbenyu at gmail.com Mon May 7 15:20:43 2007 From: bbenyu at gmail.com (bbenyu) Date: Mon, 7 May 2007 21:20:43 +0800 Subject: [Image-SIG] Installing PIL1.1.x With Python 2.5 In FreeBSD6.2 Failture. Message-ID: <200705072120394993014@gmail.com> HI all: Can you tell me what error with my installation ? I order following steps install my PIL , but final it was failture. 1??download and install the jpegsrc-6b.tar.gz from ijg.org fetch ... tar -zxf jpegsrc-6b.tar.gz cd jpeg-6b ./confgiure --prefix=/usr/local/jpeg-6b make make install ( In fact i make bin, man, man1 directoies manually) 2??download and install the PIL1.1.6 from http://www.pythonware.com/products/pil/index.htm fetch... tar -zxf Imaging-1.1.6.tar.gz cd Imaging-1.1.6 vi setup.py and change the jpeg_root value to /usr/local/jpeg-6b running python setup.py build_ext -i that shows have supported the jpeg tip. went on running python setup.py install All steps was successfuly not got any errors. When i upload the JPEG fromat picture into Django 0.96 admin ,i got the error: decoder jpeg not available /usr/local/python/lib/python2.5/site-packages/PIL/Image.py in _getdecoder, line 375 my system environment is: Freebsd 6.2 , python2.5, Django0.96 Thanks ! bbenyu 2007-05-07 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20070507/b34faa60/attachment.htm From Chris.Barker at noaa.gov Tue May 8 00:28:39 2007 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Mon, 07 May 2007 15:28:39 -0700 Subject: [Image-SIG] working with multi-spectral imagery, PIL, and NumPy In-Reply-To: <4f44d320705041447j3898ae93se949d740c8d7b7a1@mail.gmail.com> References: <4f44d320705041447j3898ae93se949d740c8d7b7a1@mail.gmail.com> Message-ID: <463FA817.6090500@noaa.gov> Check out GDAL and its python bindings. It should be able to read multi-bandTIFFs, and get the data into numpy arrays. http://www.gdal.org/ -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 amsd2013 at hotmail.com Tue May 8 05:05:09 2007 From: amsd2013 at hotmail.com (Ali Santacruz) Date: Mon, 07 May 2007 22:05:09 -0500 Subject: [Image-SIG] working with multi-spectral imagery, PIL, and NumPy Message-ID: Hi Nate, I am also working in an academic application for image processing (remote sensing data) based in Python, which is intended to accompany a book over this topic (written in Spanish). I have been working around the same tools you mention (PIL, Numpy, wxPython), as you can see in the attached file, although a problem I have found with PIL is that the georeference is lost after the processing (I have had also some problems linking this to an interface developed with wxPython, a question that I am going to send to the wxPython list soon). Now, I am looking toward GDAL. Maybe you have seen this doc: http://www.esri.com/news/arcuser/0405/files/python.pdf, where there is an interesting example using GDAL (page 2, listing 1). I tried it with my own data, but I got an unexpected result. Anyway, you can also take a look at hobutools (http://hobu.biz/software/hobutools/index_html), which include several tools (GDAL/OGR, MapScript, ?) for Python 2.4. I have written some functions for image preprocessing (contrast adjustment, PCA, filtering) in the R language, which is also a very useful language for teaching purposes, although it is not well-fitted for very large datasets, like a raster image (that is one of the reasons why I am going to make the translation to Python). I think it is also worthy to look at PCL (Python Cartographic Library) and the GRASS/Python interface, but as you know, they require a more advanced knowledge. Regards, Ali Santacruz M.Sc. Geomatics, Student National University of Colombia Bogot? D.C. >From: "Nate Jennings" >To: image-sig at python.org >Subject: [Image-SIG] working with multi-spectral imagery, PIL, and NumPy >Date: Fri, 4 May 2007 14:47:39 -0700 > >Hello... > >I am working on building an image processing application for a class I am >teaching in remote sensing. >I have multi-spectral (multi-band...greater than 3 bands of imagery) that I >would like to load into a NumPy array so I can process it. PIL seems to be >limited to 3 bands for PIL. Is there any other methods using PIL, NumPy, >or >other to work with more than 3 bands? > >The file format I am working with is TIF. The data is often from >satellites >(Landsat, SPOT, RADAR) or hyperspectral. > >I would like to do pixel processing such as custom filters that are not >found in PIL, band ratios, image enhancements such as Principle Components, >and image classification (such as maximum likelihood, or ISOData >(unsupervised classification). Many of these functions require linear >algebra, trigonometry functions, and statistics (the use of means, st >deviations, histograms, etc) as well as 3x3, 5x5, or greater kernels (i.e. >moving windows). > >>From my research there seems to be some work out there regarding 3 band >images, performance testing for PIL and C routines, some basic filtering >functions and kernel use. > >My work is related to remote sensing and GIS. Yes, I know about GRASS, but >this is too complicated for my students who know very little about remote >sensing and GIS. It looks like QGIS and GRASS have some integration, but >it >is still too cumbersome for novice users. I have been through a remote >sensing algorithms class in grad school and I have fundamental knowledge of >the math and programming logic. I am just trying to get it to work with >Python, wxPython interface building, PIL, NumPy, and anything else I may >need. Trying to communicate Python to C++ is beyond my capability without >any serious documentation or samples to work from. I know C++, but it has >been over 10 year since I programmed in this and it was done in OS2. > >Please provide me with links, sample code, and/or contacts to follow up >with. > >Thank you in advance with any information. > >Nate > >-- >http://www.jenningsplanet.com >_______________________________________________ >Image-SIG maillist - Image-SIG at python.org >http://mail.python.org/mailman/listinfo/image-sig _________________________________________________________________ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ -------------- next part -------------- A non-text attachment was scrubbed... Name: filterf.py Type: text/x-python Size: 1307 bytes Desc: not available Url : http://mail.python.org/pipermail/image-sig/attachments/20070507/522a0374/attachment.py From snaury at gmail.com Tue May 8 13:06:03 2007 From: snaury at gmail.com (Alexey Borzenkov) Date: Tue, 8 May 2007 15:06:03 +0400 Subject: [Image-SIG] Installing PIL1.1.x With Python 2.5 In FreeBSD6.2 Failture. In-Reply-To: <200705072120394993014@gmail.com> References: <200705072120394993014@gmail.com> Message-ID: Hi bbenyu, I haven't been working with unixes for a while, but I suspect your problem might be that you build shared version of libjpeg and /usr/local/jpeg-6b/lib is not on your LDPATH (or whatever variable is there for dynamic libraries search path). Try configuring libjpeg with --disable-shared --enable-static. On 5/7/07, bbenyu wrote: > > HI all: > > Can you tell me what error with my installation ? > > I order following steps install my PIL , but final it was failture. > > 1?download and install the jpegsrc-6b.tar.gz from ijg.org > fetch ... > tar -zxf jpegsrc-6b.tar.gz > cd jpeg-6b > ./confgiure --prefix=/usr/local/jpeg-6b > make > make install > ( In fact i make bin, man, man1 directoies manually) > > 2?download and install the PIL1.1.6 from > http://www.pythonware.com/products/pil/index.htm > fetch... > tar -zxf Imaging-1.1.6.tar.gz > cd Imaging-1.1.6 > vi setup.py and change the jpeg_root value to /usr/local/jpeg-6b > > running python setup.py build_ext -i > that shows have supported the jpeg tip. > went on running python setup.py install > > All steps was successfuly not got any errors. > > When i upload the JPEG fromat picture into Django 0.96 admin ,i got the > error: > > decoder jpeg not available > > /usr/local/python/lib/python2.5/site-packages/PIL/Image.py > in _getdecoder, line 375 > > my system environment is: > > Freebsd 6.2 , python2.5, Django0.96 > > Thanks ! > > ________________________________ > > bbenyu > 2007-05-07 > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > > From slm_guzel at hotmail.com Tue May 8 13:42:47 2007 From: slm_guzel at hotmail.com (=?iso-8859-9?B?U0VMTUEgR9xaRUw=?=) Date: Tue, 08 May 2007 11:42:47 +0000 Subject: [Image-SIG] opendialog Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20070508/719c6764/attachment.html From rollbak at gmail.com Wed May 9 23:50:36 2007 From: rollbak at gmail.com (Lucas Shrewsbury E.) Date: Wed, 9 May 2007 18:50:36 -0300 Subject: [Image-SIG] .act palette files support Message-ID: <194b7da00705091450t62a97adqeb768c08a5efff1a@mail.gmail.com> I've modified PIL to load palette files in .act format (the one that pthotoshop export) here i attached the diff with ImagePalette.py and ActPaletteFile.py (the one that deals with loading .act files). Hope this help someone. -- LuCaS ---------------------------------------------------- Open Your Mind, Use Open Source -------------- next part -------------- A non-text attachment was scrubbed... Name: ImagePalette.py.diff Type: application/octet-stream Size: 1222 bytes Desc: not available Url : http://mail.python.org/pipermail/image-sig/attachments/20070509/0bb555bd/attachment.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: ActPaletteFile.py Type: text/x-python Size: 936 bytes Desc: not available Url : http://mail.python.org/pipermail/image-sig/attachments/20070509/0bb555bd/attachment.py From waldemar.osuch at gmail.com Thu May 10 05:10:17 2007 From: waldemar.osuch at gmail.com (Waldemar Osuch) Date: Wed, 9 May 2007 21:10:17 -0600 Subject: [Image-SIG] opendialog In-Reply-To: References: Message-ID: <6fae95540705092010s4d1dad67nfebcb7eddbe3afd9@mail.gmail.com> On 5/8/07, SELMA G?ZEL wrote: > > I wonder if there is any modul like delphi's opendialog in python? > See a useful example here: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/438123 Waldemar From eachand at gmail.com Thu May 10 07:19:11 2007 From: eachand at gmail.com (Edmond Chand) Date: Wed, 9 May 2007 22:19:11 -0700 Subject: [Image-SIG] Need Tiff Help In-Reply-To: <6fae95540705092010s4d1dad67nfebcb7eddbe3afd9@mail.gmail.com> References: <6fae95540705092010s4d1dad67nfebcb7eddbe3afd9@mail.gmail.com> Message-ID: <000301c792c2$bf171460$6501a8c0@Rude> Hello Folks, New to python and trying to make an text branding application to batch process Tif G4 images. Where do I start does anyone have anything similar they are working on, thanks for helping. Aman From steve at holdenweb.com Thu May 10 12:53:38 2007 From: steve at holdenweb.com (Steve Holden) Date: Thu, 10 May 2007 06:53:38 -0400 Subject: [Image-SIG] Need Tiff Help In-Reply-To: <000301c792c2$bf171460$6501a8c0@Rude> References: <6fae95540705092010s4d1dad67nfebcb7eddbe3afd9@mail.gmail.com> <000301c792c2$bf171460$6501a8c0@Rude> Message-ID: <4642F9B2.10609@holdenweb.com> Edmond Chand wrote: > Hello Folks, > > New to python and trying to make an text branding application to batch > process Tif G4 images. Where do I start does anyone have anything similar > they are working on, thanks for helping. > I used to have some code that I used to draw the text images for my web site if you think that might help - you just want to draw text over an image, right? If you check the docs for the Imagedraw module you'll find it's not that scary. I have never used TIFFs, though there's no real reason to suspect that they'll be significantly different from other formats. Let me know if you want me to dredge up the code. regards Steve -- Steve Holden +1 571 484 6266 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Skype: holdenweb http://del.icio.us/steve.holden ------------------ Asciimercial --------------------- Get on the web: Blog, lens and tag your way to fame!! holdenweb.blogspot.com squidoo.com/pythonology tagged items: del.icio.us/steve.holden/python All these services currently offer free registration! -------------- Thank You for Reading ---------------- From brad at allendev.com Wed May 16 03:18:46 2007 From: brad at allendev.com (Brad Allen) Date: Tue, 15 May 2007 20:18:46 -0500 Subject: [Image-SIG] Need Tiff Help In-Reply-To: <4642F9B2.10609@holdenweb.com> References: <6fae95540705092010s4d1dad67nfebcb7eddbe3afd9@mail.gmail.com> <000301c792c2$bf171460$6501a8c0@Rude> <4642F9B2.10609@holdenweb.com> Message-ID: At 6:53 AM -0400 5/10/07, Steve Holden wrote: >Edmond Chand wrote: >> Hello Folks, >> >> New to python and trying to make an text branding application to batch >> process Tif G4 images. Where do I start does anyone have anything similar >> they are working on, thanks for helping. >> >I used to have some code that I used to draw the text images for my web >site if you think that might help - you just want to draw text over an >image, right? > >If you check the docs for the Imagedraw module you'll find it's not that >scary. I have never used TIFFs, though there's no real reason to suspect >that they'll be significantly different from other formats. > >Let me know if you want me to dredge up the code. Unfortunately PIL doesn't support TIFF Group 4 compressed images; this is an increasingly common form of TIFF compression used for black and white images such as faxes. I have tried to contact PIL commercial support but don't know if they are still in business since have not gotten a reply. In response to this deficiency in PIL, Michele Petrazzo created FreeImagePy which uses ctypes to access the FreeImage library. However it is incomplete and does not yet offer all the features of FreeImagePy, and I don't think it has anything like Imagedraw (please correct me if I'm wrong Michele). From michele.petrazzo at unipex.it Wed May 16 14:39:14 2007 From: michele.petrazzo at unipex.it (Michele Petrazzo - Unipex srl) Date: Wed, 16 May 2007 14:39:14 +0200 Subject: [Image-SIG] Need Tiff Help In-Reply-To: References: <6fae95540705092010s4d1dad67nfebcb7eddbe3afd9@mail.gmail.com> <000301c792c2$bf171460$6501a8c0@Rude> <4642F9B2.10609@holdenweb.com> Message-ID: <464AFB72.7010405@unipex.it> Brad Allen wrote: > Unfortunately PIL doesn't support TIFF Group 4 compressed images; > this is an increasingly common form of TIFF compression used for > black and white images such as faxes. I have tried to contact PIL > commercial support but don't know if they are still in business since > have not gotten a reply. > Good question! I see no posts from "Fredrik Lundh" (PIL maintainer I think) since a lot of time... > In response to this deficiency in PIL, Michele Petrazzo created > FreeImagePy which uses ctypes to access the FreeImage library. > However it is incomplete I don't wrap some functions because I don't need them! Those are only "advanced" and normally I don't use them into my programs. > and does not yet offer all the features of FreeImagePy, and I don't > think it has anything like Imagedraw (please correct me if I'm wrong > Michele). This is right. I tried to do it, but the problem it's that I need a freetype (I think that it's the only one that can help me to do this) python binding that wrote the text strings by me. And now I have no time for take my code into my hands and end the wrap... If some one want to end it... :) Michele -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3273 bytes Desc: S/MIME Cryptographic Signature Url : http://mail.python.org/pipermail/image-sig/attachments/20070516/409de7be/attachment.bin From gwidion at mpc.com.br Wed May 16 14:55:44 2007 From: gwidion at mpc.com.br (Joao S. O. Bueno Calligaris) Date: Wed, 16 May 2007 09:55:44 -0300 Subject: [Image-SIG] Need Tiff Help In-Reply-To: References: <4642F9B2.10609@holdenweb.com> Message-ID: <200705160955.45078.gwidion@mpc.com.br> Sorry - I have no time to help you right now. But yoiu really should try to make a PIL image object out of your read TIFF image with the other library, so you can use everything available in PIL. Regards, js -><- On Tuesday 15 May 2007 22:18, Brad Allen wrote: > At 6:53 AM -0400 5/10/07, Steve Holden wrote: > >Edmond Chand wrote: > >> Hello Folks, > >> > >> New to python and trying to make an text branding application > >> to batch process Tif G4 images. Where do I start does anyone > >> have anything similar they are working on, thanks for helping. > > > >I used to have some code that I used to draw the text images for > > my web site if you think that might help - you just want to draw > > text over an image, right? > > > >If you check the docs for the Imagedraw module you'll find it's > > not that scary. I have never used TIFFs, though there's no real > > reason to suspect that they'll be significantly different from > > other formats. > > > >Let me know if you want me to dredge up the code. > > Unfortunately PIL doesn't support TIFF Group 4 compressed images; > this is an increasingly common form of TIFF compression used for > black and white images such as faxes. I have tried to contact PIL > commercial support but don't know if they are still in business > since have not gotten a reply. > > In response to this deficiency in PIL, Michele Petrazzo created > FreeImagePy which uses ctypes to access the FreeImage library. > However it is incomplete and does not yet offer all the features of > FreeImagePy, and I don't think it has anything like Imagedraw > (please correct me if I'm wrong Michele). > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig From joanca at casasin.com Tue May 15 13:04:29 2007 From: joanca at casasin.com (=?ISO-8859-1?Q?Joancarles_Casas=EDn?=) Date: Tue, 15 May 2007 13:04:29 +0200 Subject: [Image-SIG] flatten 1 bit images Message-ID: <6EFA76B8-821F-42B0-950F-E682E976D063@casasin.com> Hi you all, Maybe it's the silliest question ever to the list but I really couldn't find out trying and trying with this. (not an expert as you see) I'd like to flatten four 1 bit images in a resulting one, having white as transparent an all black pixels in the separated images visible. I can't do it directly. Do I need to make any conversion before? is this possible? Many thanks for your help, Joancarles ????????????????? www.casasin.com ????????????????? From newz at bearfruit.org Wed May 16 16:43:41 2007 From: newz at bearfruit.org (Matthew Nuzum) Date: Wed, 16 May 2007 09:43:41 -0500 Subject: [Image-SIG] flatten 1 bit images In-Reply-To: <6EFA76B8-821F-42B0-950F-E682E976D063@casasin.com> References: <6EFA76B8-821F-42B0-950F-E682E976D063@casasin.com> Message-ID: On 5/15/07, Joancarles Casas?n wrote: > I'd like to flatten four 1 bit images in a resulting one, having > white as transparent an all black pixels in the separated images > visible. I can't do it directly. > Do I need to make any conversion before? is this possible? Sorry, I'm not expert in imaging, but just wanted to say that your job sounds like a simple case of boolean math. 1100000011 | 1000011110 =========== 1100011111 So even if you're not able to do this in pil, if you can convert your image to an array of bits, you can then OR them together to get the resulting output. I've only done this in C and asm, but it's literally the simplest type of math for CPUs to do. ... just doing a little testing, I've never dealt with binary in python... Looks like the normal stuff works. Since: 9 == 1001b 8 == 1000b 1 == 0001b then: >>> 9 & 1 1 >>> 8 | 1 9 -- Matthew Nuzum www.bearfruit.org newz2000 on freenode From joanca at casasin.com Wed May 16 16:49:59 2007 From: joanca at casasin.com (=?ISO-8859-1?Q?Joancarles_Casas=EDn?=) Date: Wed, 16 May 2007 16:49:59 +0200 Subject: [Image-SIG] flatten 1 bit images In-Reply-To: References: <6EFA76B8-821F-42B0-950F-E682E976D063@casasin.com> Message-ID: <6DA7D320-01DB-475B-8803-A12D2C457F83@casasin.com> On 16/05/2007, at 16:43, Matthew Nuzum wrote: > Sorry, I'm not expert in imaging, but just wanted to say that your job > sounds like a simple case of boolean math. Thanks Matthew for your comment. I'll try as soon as I can get back to that. Cheers, Joancarles ????????????????? www.casasin.com ????????????????? From robjnorman at sbcglobal.net Fri May 18 03:50:41 2007 From: robjnorman at sbcglobal.net (Robert) Date: Thu, 17 May 2007 18:50:41 -0700 Subject: [Image-SIG] Help with PIL image.tostring Message-ID: <464D0671.6050902@sbcglobal.net> I'm new to PIL and wanted to use Image.tostring for inline graphics under mod-python. Seems like a good fit but I can't seem to come up with the format of the required second parameter when you do output = im.tostring ("jpeg", ???) The python traceback says the second parameter is required and it's string. I've checked out several version of the PIL handbook and tried figuring it out from the code for JpegImagePlugin.py but don't really understand how the original call maps to the plugin. What should be put in the second parameter. Aren't all the options defaulted? Thanks Robert -------------------------------------------------------------------------------------- If this is a duplicate of an earlier post, I had tried several times from another mail account and it kept getting bounced. From fredrik at pythonware.com Fri May 18 11:09:40 2007 From: fredrik at pythonware.com (Fredrik Lundh) Date: Fri, 18 May 2007 11:09:40 +0200 Subject: [Image-SIG] Help with PIL image.tostring In-Reply-To: <464D0671.6050902@sbcglobal.net> References: <464D0671.6050902@sbcglobal.net> Message-ID: Robert wrote: > I'm new to PIL and wanted to use Image.tostring for inline graphics > under mod-python. Seems like a good fit but I can't seem to come up with > the format of the required second parameter when you do > > output = im.tostring ("jpeg", ???) tostring() should only be used if you want to transfer the actual pixels to some other library (e.g. numpy), or if you're doing custom encoding for non-standard formats. if you want to save an image in a standard format, use im.save() and a StringIO buffer instead: f = StringIO.StringIO() im.save(f, "JPEG") data = f.getvalue() From noahspurrier at gmail.com Mon May 14 20:14:42 2007 From: noahspurrier at gmail.com (Noah.org) Date: Mon, 14 May 2007 11:14:42 -0700 Subject: [Image-SIG] Submitting patches Message-ID: Is there a mechanism for submitting patches? I added a method to return the average difference between two images as a single scalar value. This is useful for calculating motion offsets and detecting scene changes. Yours, Noah From tfcrobert at gmail.com Fri May 18 01:35:49 2007 From: tfcrobert at gmail.com (Robert Norman) Date: Thu, 17 May 2007 16:35:49 -0700 Subject: [Image-SIG] Help with image.tostring parameters Message-ID: <4ca92f240705171635k757bff04xba81c584e467b88c@mail.gmail.com> I'm new to PIL and wanted to use Image.tostring for inline graphics under mod-python. Seems like a good fit but I can't seem to come up with the format of the required second parameter when you do output = im.tostring ("jpeg", ???) The python traceback says the second parameter is required and it's string. I've checked out several version of the PIL handbook and tried figuring it out from the code for JpegImagePlugin.py but don't really understand how the original call maps to the plugin. What should be put in the second parameter. Aren't all the options defaulted? Thanks Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20070517/7ad408cd/attachment.html From wbsmith at gmail.com Fri May 18 21:38:23 2007 From: wbsmith at gmail.com (W. Bryan Smith) Date: Fri, 18 May 2007 12:38:23 -0700 Subject: [Image-SIG] reading multi-frame tiff images? In-Reply-To: References: Message-ID: hi, i am wondering if there is a faster way to find the number of frames or pages in a 3-d tiff image than doing something like this: img = Image.open("myFile.tif") frame = 0 try: while 1: img.seek(frame) frame = frame + 1 except EOFError: img.seek(0) pass any hints on this? i looked through all the tags and did not find anything that tells the number of frames in the 3-d tiff images i am working with. this code works, but seems to be somewhat slow. also, along these lines, i wonder if there is generally any faster way to read these multi-frame tiff images than what i list above (assuming i also then assign img to some 3-d array i made using numpy). doing so with my images can take up to twice as long as if i read the same images in matlab (an average of 1.88 times slower when i test with a bunch of different images). even as compared to my matlab code, the actual read time is not prohibitively slow, but is considerably slower than any other means i have of reading the images, so i am guessing there must be a better way for me to read the data than this try: statement. thanks for any insight! bryan From brad at allendev.com Tue May 22 23:58:56 2007 From: brad at allendev.com (Brad Allen) Date: Tue, 22 May 2007 16:58:56 -0500 Subject: [Image-SIG] whither PythonMagick? In-Reply-To: References: Message-ID: Has anyone here worked with PythonMagick? There is no clear documentation on how to get it working, no setup.py, and it looks like some necessary modules are missing (the __init__.py refers to modules that are not present). http://www.imagemagick.org/script/api.php#python Here are comments from a Perl developer who may decide not to switch to Python because of lack of ImageMagick support. http://sxoop.wordpress.com/2006/11/29/whither-pythonmagick/ Excerpt: "I want to give Python a chance. I really do. But things don't look too promising on the ImageMagick front." For my part, I need an ImageMagick capability that I have yet to find elsewhere, namely the ability to rotate TIFF files with Group 4 compression, with no loss of compression. If anyone has knows a better way, I would appreciate hearing about it. From wbsmith at gmail.com Wed May 23 00:38:09 2007 From: wbsmith at gmail.com (W. Bryan Smith) Date: Tue, 22 May 2007 15:38:09 -0700 Subject: [Image-SIG] working with multi-spectral imagery, PIL, and NumPy Message-ID: hi nate, i am wondering what you have tried with PIL and numpy. there is a tiff header that specifies samples per pixel, and PIL should be able to get the data based on that. so if you do: import Image img = Image.open('yourImage.tif') img.tag.get(277)[0] what does it return? i have written some code that successfully puts rgb tiff data into numpy arrays, but i don't have any means of trying it with anything more than rgb data. i am very new to python and even newer to using PIL (as in, a couple days), but the code i have seems to be working. bryan From Jim.Vickroy at noaa.gov Wed May 23 16:38:01 2007 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Wed, 23 May 2007 08:38:01 -0600 Subject: [Image-SIG] whither PythonMagick? In-Reply-To: References: Message-ID: <465451C9.8080100@noaa.gov> Brad Allen wrote: > Has anyone here worked with PythonMagick? There is no clear > documentation on how to get it working, no setup.py, and it looks > like some necessary modules are missing (the __init__.py refers to > modules that are not present). > > http://www.imagemagick.org/script/api.php#python > > Here are comments from a Perl developer who may decide not to switch > to Python because of lack of ImageMagick support. > > http://sxoop.wordpress.com/2006/11/29/whither-pythonmagick/ > > Excerpt: "I want to give Python a chance. I really do. But things > don't look too promising on the ImageMagick front." > > For my part, I need an ImageMagick capability that I have yet to find > elsewhere, namely the ability to rotate TIFF files with Group 4 > compression, with no loss of compression. If anyone has knows a > better way, I would appreciate hearing about it. > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > I'm not an ImageMagick, but I found this somewhat dated (Dec-2005) posting that may be of value: """ FWIW: I tried PythonMagick for a while, but soon found that large or complex images caused it to consume excessive memory and sometimes crash, taking my application with it. I switched to the command line interface to isolate my application from problems in Graphics/ImageMagick. Everything ended up much more robust that way, and the time cost is small--it's on the order of milliseconds. """ from http://mail.python.org/pipermail/python-list/2005-December/355374.html -- jv From cz at gocept.com Thu May 24 14:34:40 2007 From: cz at gocept.com (Christian Zagrodnick) Date: Thu, 24 May 2007 14:34:40 +0200 Subject: [Image-SIG] cannot import from PIL when easy_installed References: <45C639E1.2030003@gmail.com> Message-ID: Hi there On 2007-02-04 20:54:09 +0100, Daniel Nouri said: > > When you install PIL via easy_install, you cannot import from the PIL > module. Is this a bug in PIL or in code that tries to import "from PIL"? > > >>> import PIL > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named PIL > >>> import Image #no error > > This is how I install PIL: > > $ easy_install --find-links http://www.pythonware.com/products/pil/ \ > Imaging > > There is an open ticket in Plone for this > http://dev.plone.org/plone/ticket/5883 Yes, it would be very nice if PIL got setuptools aware. The current state not optimal. Escpecially because it *does* install but then is not correctly installed. The setuptools integration is quite important for automatically setting up a whole software bundle. What happens on install is that PIL is not installed as a package but its *contents* clutters the namespace. So you get to import Image instead of PIL. But you also could just `import ArgImagePlugin` like you'd `import sys`. So, is anybody taking care of this? -- Christian Zagrodnick gocept gmbh & co. kg ? forsterstrasse 29 ? 06112 halle/saale www.gocept.com ? fon. +49 345 12298894 ? fax. +49 345 12298891 From gwidion at mpc.com.br Sat May 26 14:48:05 2007 From: gwidion at mpc.com.br (Joao S. O. Bueno Calligaris) Date: Sat, 26 May 2007 09:48:05 -0300 Subject: [Image-SIG] whither PythonMagick? In-Reply-To: References: Message-ID: <200705260948.05989.gwidion@mpc.com.br> On Tuesday 22 May 2007 18:58, Brad Allen wrote: > Has anyone here worked with PythonMagick? There is no clear > documentation on how to get it working, no setup.py, and it looks > like some necessary modules are missing (the __init__.py refers to > modules that are not present). > > http://www.imagemagick.org/script/api.php#python > > Here are comments from a Perl developer who may decide not to > switch to Python because of lack of ImageMagick support. > > http://sxoop.wordpress.com/2006/11/29/whither-pythonmagick/ > > Excerpt: "I want to give Python a chance. I really do. But things > don't look too promising on the ImageMagick front." > > For my part, I need an ImageMagick capability that I have yet to > find elsewhere, namely the ability to rotate TIFF files with Group > 4 compression, with no loss of compression. If anyone has knows a > better way, I would appreciate hearing about it. > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig Hi ... I managed to get it working once. I am without a tre of it ehre now, but I remember that it sues a python stuff for building that was supposed to do what autottools do. You have to install that. Just google for the names of the python scripts you find in the base dir. When you hist a package that is meant for building ups, install that, and there you go. js -><- From snaury at gmail.com Mon May 28 18:42:53 2007 From: snaury at gmail.com (Alexey Borzenkov) Date: Mon, 28 May 2007 20:42:53 +0400 Subject: [Image-SIG] Problem with rgb->bgr15 convertion Message-ID: Hi all, I had to save images in BGR;15 format and suddenly found that image quality unexpectedly and quickly degraded during convertions. Here's the patch that fixes this problem: Index: libImaging/Convert.c =================================================================== --- libImaging/Convert.c (revision 277) +++ libImaging/Convert.c (working copy) @@ -208,7 +208,7 @@ UINT16* out = (UINT16*) out_; for (x = 0; x < xsize; x++, in += 4) *out++ = - ((((UINT16)in[0])<<8)&0x7c00) + + ((((UINT16)in[0])<<7)&0x7c00) + ((((UINT16)in[1])<<2)&0x03e0) + ((((UINT16)in[2])>>3)&0x001f); } From ashokagk at gmail.com Mon May 28 23:58:40 2007 From: ashokagk at gmail.com (Dr.Ashoka G K) Date: Tue, 29 May 2007 03:28:40 +0530 Subject: [Image-SIG] window level and width Message-ID: <259a47240705281458o17d66e23n8d389c7fb6703465@mail.gmail.com> hi, Many DICOM related softwares have a feature to alter window level and window width of the images. Is this the same as changing the brightness and contrast of the image? If not, how does it differ? Can it be implemented in PIL? Thanks in advance for any help. _____ Ashok From noahspurrier at gmail.com Tue May 29 18:41:08 2007 From: noahspurrier at gmail.com (Noah.org) Date: Tue, 29 May 2007 09:41:08 -0700 Subject: [Image-SIG] Dev notes on PIL core Message-ID: I'm adding a difference_rms(im1, im2) method to ImageChops. It's fast and works with 1-bit BW, 8-bit gray, and 24-bit color. I plan to post patches to this group when I'm done testing. I have gotten only a little bit familiar with the C code. My concern at this point is the proper way to raise exceptions. I want to raise an exception if the images are in different modes or if the sizes do not match (ImagingError_ModeError or ImagingError_Mismatch). My C function in Chops.c returns a double (the difference RMS value). Most of the functions in Chops.c return Imaging objects, so if there is an exception they can easily return an ImagingError. I want to make my code follow the conventions already being used. Can anyone suggest the best way to handle raising an exception from C code that only returns a double? The heart of the function that I have added to Chops.c looks like this: double ImagingChopDifferenceRMS(Imaging imIn1, Imaging imIn2) { int x, y; long count, n, ns; if (!imIn1 || !imIn2 || imIn1->type != IMAGING_TYPE_UINT8 || (strcmp(imIn1->mode, imIn2->mode) != 0)) return -1.0; //(Imaging) ImagingError_ModeError(); if (imIn1->type != imIn2->type || imIn1->bands != imIn2->bands || imIn1->ysize != imIn2->ysize || imIn1->xsize != imIn2->xsize) return -2.0; //(Imaging) ImagingError_Mismatch(); ns = 0; count = 0; for (y = 0; y < imIn1->ysize; ++y) { UINT8* in1 = (UINT8*) imIn1->image[y]; UINT8* in2 = (UINT8*) imIn2->image[y]; for (x = 0; x < imIn1->linesize; ++x) { ++count; n = (long) in1[x] - (long) in2[x]; ns += n*n; } } return sqrt((double)ns / (double)count); } Yours, Noah P.S. I realize RMS comparisons can be done with PIL and Python alone, but a C implementation is AT LAST 10 times faster than doing something like this (the fastest way I could find to do it in Python alone): h1 = Image.open("im1.jpg").histogram() h2 = Image.open("im2.jpg").histogram() rms = math.sqrt(reduce(operator.add, map(lambda a,b: (a-b)**2, h1, h2))/len(h1)) From jantod at gmail.com Tue May 29 22:06:46 2007 From: jantod at gmail.com (Janto Dreijer) Date: Tue, 29 May 2007 22:06:46 +0200 Subject: [Image-SIG] too many files open Message-ID: Hi! I have a suggestion that would hopefully allow slightly better lazy loading of Images. Currently data is only read from disk when operations are applied to an image. This works great when images are few and large. Unfortunately ImageFile.__init__ opens a handle to the file. On systems with a maximum of ~255 handles per process (?) this is causing some problems, throwing a "too many files open" exception. Reports of this happening can be found through Google. I'm suggesting adding the following 2 lines to the start of ImageFile.load: if self.fp is None and self.filename: self.fp = open(self.filename, "rb") This will allow one to do the following and still use images as normal. images = [] for i in range(10000): image = Image.open("bla.png") image.verify() # release file handle images.append(image) Maybe I'm missing something obvious as I haven't tested this exhaustively. It seemed to solve my problem, so I'm just throwing this out there. Regards Janto From archsheep at yahoo.com.br Fri May 18 14:21:41 2007 From: archsheep at yahoo.com.br (Alex Torquato S. Carneiro) Date: Fri, 18 May 2007 12:21:41 -0000 Subject: [Image-SIG] Image to matrix Message-ID: <346753.73947.qm@web63404.mail.re1.yahoo.com> I'm doing a project in Python. It's a capture and process a image, I'm using PIL for images and scipy (together numpy) for processing, about fft, filter, etc.. I'm needing to convert a image in a matrix type, can anyone help me? Thanks. Alex. __________________________________________________ Fale com seus amigos de gra?a com o novo Yahoo! Messenger http://br.messenger.yahoo.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20070518/734237ad/attachment.htm