From jjkk73 at gmail.com Tue Oct 2 11:08:59 2007 From: jjkk73 at gmail.com (jorma kala) Date: Tue, 2 Oct 2007 11:08:59 +0200 Subject: [Image-SIG] Using ImageGrab to capture screen of remote computer Message-ID: Hi, Is it possible to use ImageGrab of the Python Imaging Library to capture the screen of a remote computer? I'm running my python program on a computer that is connected directly via a ethernet crossover cable to another computer. Can I somehow get ImageGrab to grab the display of the remote computer by specifying the IP address ? Thanks a lot jorma -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20071002/0a1124d8/attachment.htm From joperry at purdue.edu Wed Oct 3 00:07:47 2007 From: joperry at purdue.edu (joperry at purdue.edu) Date: Tue, 2 Oct 2007 18:07:47 -0400 Subject: [Image-SIG] fromstring image question Message-ID: <1191362867.4702c133721ac@webmail.purdue.edu> Hi everyone, I am having difficulty using the Image.fromstring(args) command. My data is little endian 16 bit unsigned int. When I try to use the correct decoder "F;16" idle fails. Here is an example: img2=Image.fromstring("L",(512,512), buffed, "raw", "F;16") Traceback (most recent call last): File "", line 1, in img2=Image.fromstring("L",(512,512), buffed, "raw", "F;16") File "C:\Python25\lib\site-packages\PIL\Image.py", line 1744, in fromstring im.fromstring(data, decoder_name, args) File "C:\Python25\lib\site-packages\PIL\Image.py", line 570, in fromstring d = _getdecoder(self.mode, decoder_name, args) File "C:\Python25\lib\site-packages\PIL\Image.py", line 373, in _getdecoder return apply(decoder, (mode,) + args + extra) ValueError: unknown raw mode For a more accurate following of the problem I am using this forum for help too. http://www.thescripts.com/forum/thread716616.html Thanks for any advice in advance, John Perry From fredrik at pythonware.com Thu Oct 4 22:04:35 2007 From: fredrik at pythonware.com (Fredrik Lundh) Date: Thu, 04 Oct 2007 22:04:35 +0200 Subject: [Image-SIG] fromstring image question In-Reply-To: <1191362867.4702c133721ac@webmail.purdue.edu> References: <1191362867.4702c133721ac@webmail.purdue.edu> Message-ID: joperry at purdue.edu wrote: > I am having difficulty using the Image.fromstring(args) command. My data is > little endian 16 bit unsigned int. When I try to use the correct decoder "F;16" > idle fails. Here is an example: > > img2=Image.fromstring("L",(512,512), buffed, "raw", "F;16") the image mode must match the raw mode type; "F;16" expects 16-bit integers on input, and wants to store the result in a floating point image. try using "L;16" instead, or change the image mode to "F". From lists+Image_SIG at hoech.org Fri Oct 5 00:05:16 2007 From: lists+Image_SIG at hoech.org (=?ISO-8859-1?Q?Florian_H=F6ch?=) Date: Fri, 05 Oct 2007 00:05:16 +0200 Subject: [Image-SIG] BUG: PIL DPI trouble - fix for TIFF files (PIL 1.1.6) In-Reply-To: <2ce6cd010709210312u7b7d474ct48bb877d7eb0c09b@mail.gmail.com> References: <2ce6cd010709210312u7b7d474ct48bb877d7eb0c09b@mail.gmail.com> Message-ID: <4705639C.9080608@hoech.org> PIL only adds a dpi entry in the info dictionary if no resolution unit is specified in the TIFF file. This seems to be because of a misinterpretation of resolution unit values: they have a different meaning than in a JPEG file. JPEG: 0 = None; 1 = inches; 2 = cm. TIFF: 1 = None; 2 = inches; 3 = cm (see http://www.awaresystems.be/imaging/tiff/tifftags/resolutionunit.html and http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/JPEG.html) Here's a quick fix: Open TiffImagePlugin.py and go to line 577. Change the code: xres = getscalar(X_RESOLUTION, (1, 1)) yres = getscalar(Y_RESOLUTION, (1, 1)) if xres and yres: xres = xres[0] / (xres[1] or 1) yres = yres[0] / (yres[1] or 1) resunit = getscalar(RESOLUTION_UNIT, 1) if resunit == 2: # Inches self.info["dpi"] = xres, yres elif resunit == 3: # Centimeters self.info["dpi"] = xres * 2.54, yres * 2.54 else: # No absolute unit of measurement. self.info["resolution"] = xres, yres Regards, Florian Hoech From bloominator at hotmail.com Mon Oct 8 22:23:48 2007 From: bloominator at hotmail.com (Gary Bloom) Date: Mon, 8 Oct 2007 16:23:48 -0400 Subject: [Image-SIG] PIL DPI trouble - Solved References: <2ce6cd010709210312u7b7d474ct48bb877d7eb0c09b@mail.gmail.com> <2ce6cd010709260730q261998e9q33a946afdda3181e@mail.gmail.com> Message-ID: Hi Luca, Sorry it has taken me so long to get back to you... The first thing that jumps out at me about what you've written below is that you've been working on MacOSX and I have been working under XP. I have done testing in the past few months, similar to what you've done, but without the same results. What you've done and the results you see make sense, but I just don't get the same thing under XP. I have been running Python 2.4.4 and PIL 1.1.6 under XP SP2. My goal is to try to get my hands on an old Mac and redo my testing under OSX. I am hoping that I will see your results, and then I can say that the problem is platform-specific. As soon as I can get my hands on Photoshop or PSP for the Mac, I will try to make that happen. By the way, is there any chance that you've done any testing under Windows? Regards, Gary ----- Original Message ----- From: "Luca De Santis" To: "Gary Bloom" ; Cc: Sent: Wednesday, September 26, 2007 10:30 AM Subject: Re: PIL DPI trouble - Solved >> .... >> Any thoughts on this? Or perhaps can you >> point me to someone who can shed even more light on the matter? > > Hi Gary > sorry if it took me some time to get back on this topic. > > I made a couple of tests, that I describe below, which seems to > confirm the correct behavior of PIL in managing the dpi of JPEGs. Take > everything "with a grain of salt" since I'm not an expert on the > subject: I just followed an empiric method which seems quite sound. > > First of all, I'm dealing with JPEGs so I can't say if what I'm doing > applies to other file formats. > My test environment consists of Python 2.1.3 (I used also Python 2.5 > with no apparent changes), PIL 1.1.6 on a Mac OS X 10.4. I'm reading > images with Photoshop 7 plus Preview and Graphic Converter 5.9.5 which > are Mac specific applications. > > > # First test: reading a JPEG image # > > I started from a simple JPEG created from Photoshop and saved at 150 > dpi (image.jpg). > Hexdumping the image I get, as expected, the following values for the > field of the JFIF Segment (cfr. > http://en.wikipedia.org/wiki/JFIF#JFIF_Segment_Format ): > * Density Unit: 0x01 (dpi) > * X/Y Density: 0x0096 (150) > > I read the image with PIL in the following way: >>>> import Image >>>> i = Image.open('image.jpg') >>>> i.info['dpi'] > (150, 150) > > Opening the image with the other two applications just gives the same > value for the resolution. > > Now I opened again the image from Photoshop and saved it with the > "Save for Web" option, using the name "image2.jpg". > Hexdumping the image I had the following values for the JFIF attributes: > * Density Unit: 0x00 (No units, aspect ratio only specified) > * X/Y Density: 0x0064 (100) > The 100 value seems to make sense because, according to the Density > Unit value, it is the ratio (100%) by which you should use/visualize > the image. > > Now with PIL you (correctly) can't read the dpi attribute anymore. >>>> i = Image.open('image2.jpg') >>>> i.info > {'adobe_transform': 100, 'jfif_density': (100, 100), 'jfif_version': > (1, 2), 'adobe': 100, 'jfif_unit': 0, 'jfif': 258} > > Opening the image again with Photoshop and selecting the "Image size" > option you get 72 dpi but this seems a sort of default behavior of > this application. > Preview for example lefts blank in this case the dpi attribute, while > Graphic Converter must have a bug since it thinks that the resolution > is 100 dpi! > > _Conclusion_: > PIL seems to interpret correctly the JFIF attributes. PIL also reads > the EXIF attributes if present: they are stored in the 'app' > dictionary associated to the Image instance. > > > # Second test: saving a JPEG image # > > Things are a bit different when the JPEG image is saved through PIL, > which _by default_ doesn't handle the dpi attribute (see also below). > > In fact, I opened again the 150 dpi image, and saved with name > "image3.jpg" through PIL with the following commands: >>>> i = Image.open('image.jpg') >>>> i.info['dpi'] > (150, 150) >>>> i.save('image3.jpg') >>>> i3 = Image.open('image3.jpg') >>>> i3.info > {'jfif_density': (1, 1), 'jfif_unit': 0, 'jfif': 257, 'jfif_version': (1, > 1)} > > Hexdumping image3.jpg you get: > * Density Unit: 0x00 (No units, aspect ratio only specified) > * X/Y Density: 0x0001 > > Now, I don't really know if the correct value here should be 1 or 100 > (I honestly assume 100, so probably this could be a PIL bug). > > If you want to maintain the original dpi with PIL when saving the > image just do the following: > i.save(filename, dpi=i.info['dpi']) > > In fact: >>>> i = Image.open('image.jpg') >>>> i.info['dpi'] > (150, 150) >>>> i.save('image4.jpg', dpi=i.info['dpi']) >>>> i4 = Image.open('image4.jpg') >>>> i4.info > {'dpi': (150, 150), 'jfif_density': (150, 150), 'jfif_unit': 1, > 'jfif': 257, 'jfif_version': (1, 1)} > > Hexdumping this new image I got: > * Density Unit: 0x01 (dpi) > * X/Y Density: 0x0096 (150) > and all the applications, Photoshop included, recognize the right > resolution (150dpi) for the image. > > _Conclusion_: > Just remember to specify the 'dpi' parameter when saving a JPEG whose > resolution should be different than 72dpi. > > Sorry if I wrote too much! I honestly don't know other things on that > so I hoped I helped to shed some light on this matter. > > Ciao, > Luca > > Luca De Santis, > Pisa, Italy > From ematus at gmail.com Mon Oct 8 01:49:29 2007 From: ematus at gmail.com (Eduardo Matus) Date: Sun, 7 Oct 2007 19:49:29 -0400 Subject: [Image-SIG] Image transpose Message-ID: <984ad6a0710071649s535c4e80o326abb5f21e8e343@mail.gmail.com> Hi, I'm transposing an image.. but in each rotation, the image loose resolution.. any ideas? this is the code that I'm using im = Image.open(self.imageList[self.imagenIndex]) out = im.transpose(Image.ROTATE_90) out.save(self.imageList[self.imagenIndex]) Thks -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20071007/df641c23/attachment.htm From nadavh at visionsense.com Tue Oct 9 07:57:29 2007 From: nadavh at visionsense.com (Nadav Horesh) Date: Tue, 9 Oct 2007 07:57:29 +0200 Subject: [Image-SIG] Image transpose Message-ID: <710F2847B0018641891D9A21602763600B6DEA@ex3.envision.co.il> Do you save it in a lossy compression format (like jpeg with quality < 100%)? Nadav, -----Original Message----- From: image-sig-bounces at python.org on behalf of Eduardo Matus Sent: Mon 08-Oct-07 01:49 To: image-sig at python.org Subject: [Image-SIG] Image transpose Hi, I'm transposing an image.. but in each rotation, the image loose resolution.. any ideas? this is the code that I'm using im = Image.open(self.imageList[self.imagenIndex]) out = im.transpose(Image.ROTATE_90) out.save(self.imageList[self.imagenIndex]) Thks From norman at khine.net Thu Oct 11 10:35:25 2007 From: norman at khine.net (Norman Khine) Date: Thu, 11 Oct 2007 10:35:25 +0200 Subject: [Image-SIG] PIL scale attributes to fit 250x250 max Message-ID: <470DE04D.1040704@khine.net> Hello, Please excuse me, I am new to PIL, and was wondering which is the best method to do the following. I have an application where users upload an image, at the moment if the image is over a certain size, it returns with an error asking the user to correct this. I would like for my application to make the necessary adjustments to the image, but am unsure as to how to handle the portrait vs landscape image resizing. The image box, for example is 250x250. So from the example on http://www.pythonware.com/library/pil/handbook/image.htm I will have something like: from PIL import Image import glob, os size = 250, 250 for infile in glob.glob("*.jpg"): file, ext = os.path.splitext(infile) im = Image.open(infile) im.thumbnail(size, Image.ANTIALIAS) im.save(file + ".thumbnail", "JPEG") But this creates a 250x250 thumbnail, whereas I would like if the image is say 500x635 in size to reduce this to 196x250 and the same for my portrait image if this is 625x500 to reduce this to 250x196 Thanks -- Norman %>>> "".join( [ {'*':'@','^':'.'}.get(c,None) or chr(97+(ord(c)-83)%26) for c in ",adym,*)&uzq^zqf" ] ) From bentson at holmsjoen.com Thu Oct 11 14:31:01 2007 From: bentson at holmsjoen.com (Randolph Bentson) Date: Thu, 11 Oct 2007 05:31:01 -0700 Subject: [Image-SIG] PIL scale attributes to fit 250x250 max In-Reply-To: <470DE04D.1040704@khine.net> References: <470DE04D.1040704@khine.net> Message-ID: <20071011123101.GB30711@holmsjoen.com> On Thu, Oct 11, 2007 at 10:35:25AM +0200, Norman Khine wrote: > But this creates a 250x250 thumbnail, whereas I would like if the image > is say 500x635 in size to reduce this to 196x250 and the same for my > portrait image if this is 625x500 to reduce this to 250x196 How about the following: from PIL import Image import glob, os max_dimension = 250 for infile in glob.glob("*.jpg"): file, ext = os.path.splitext(infile) im = Image.open(infile) larger = max(im.size) size = im.size[0]*max_dimension/larger, im.size[1]*max_dimension/larger im.thumbnail(size, Image.ANTIALIAS) im.save(file + ".thumbnail", "JPEG") -- Randolph Bentson bentson at holmsjoen.com From fredrik at pythonware.com Fri Oct 12 22:08:47 2007 From: fredrik at pythonware.com (Fredrik Lundh) Date: Fri, 12 Oct 2007 22:08:47 +0200 Subject: [Image-SIG] PIL scale attributes to fit 250x250 max In-Reply-To: <470DE04D.1040704@khine.net> References: <470DE04D.1040704@khine.net> Message-ID: Norman Khine wrote: > The image box, for example is 250x250. > So from the example on > http://www.pythonware.com/library/pil/handbook/image.htm I will have > something like: > > from PIL import Image > import glob, os > > size = 250, 250 > > for infile in glob.glob("*.jpg"): > file, ext = os.path.splitext(infile) > im = Image.open(infile) > im.thumbnail(size, Image.ANTIALIAS) > im.save(file + ".thumbnail", "JPEG") > > But this creates a 250x250 thumbnail Only if you apply it on a square image. > whereas I would like if the image > is say 500x635 in size to reduce this to 196x250 and the same for my > portrait image if this is 625x500 to reduce this to 250x196 Not sure how you're rounding things here, but PIL's thumbnail method does indeed preserve the aspect ratio: >>> from PIL import Image >>> im = Image.new("RGB", (500, 635)) >>> im.size (500, 635) >>> im.thumbnail((250, 250)) >>> im.size (197, 250) >>> im = Image.new("RGB", (625, 500)) >>> im.size (625, 500) >>> im.thumbnail((250, 250)) >>> im.size (250, 200) >>> From norman at khine.net Sat Oct 13 09:29:10 2007 From: norman at khine.net (Norman Khine) Date: Sat, 13 Oct 2007 09:29:10 +0200 Subject: [Image-SIG] PIL scale attributes to fit 250x250 max In-Reply-To: References: <470DE04D.1040704@khine.net> Message-ID: <471073C6.5000608@khine.net> Thanks Fredrik. Fredrik Lundh wrote: > Norman Khine wrote: > >> The image box, for example is 250x250. >> So from the example on >> http://www.pythonware.com/library/pil/handbook/image.htm I will have >> something like: >> >> from PIL import Image >> import glob, os >> >> size = 250, 250 >> >> for infile in glob.glob("*.jpg"): >> file, ext = os.path.splitext(infile) >> im = Image.open(infile) >> im.thumbnail(size, Image.ANTIALIAS) >> im.save(file + ".thumbnail", "JPEG") >> >> But this creates a 250x250 thumbnail > > Only if you apply it on a square image. > >> whereas I would like if the image >> is say 500x635 in size to reduce this to 196x250 and the same for my >> portrait image if this is 625x500 to reduce this to 250x196 > > Not sure how you're rounding things here, but PIL's thumbnail method > does indeed preserve the aspect ratio: > > >>> from PIL import Image > >>> im = Image.new("RGB", (500, 635)) > >>> im.size > (500, 635) > >>> im.thumbnail((250, 250)) > >>> im.size > (197, 250) > > >>> im = Image.new("RGB", (625, 500)) > >>> im.size > (625, 500) > >>> im.thumbnail((250, 250)) > >>> im.size > (250, 200) > >>> > > > > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > -- Norman Khine %>>> "".join( [ {'*':'@','^':'.'}.get(c,None) or chr(97+(ord(c)-83)%26) for c in ",adym,*)&uzq^zqf" ] ) From bloominator at hotmail.com Wed Oct 10 16:18:11 2007 From: bloominator at hotmail.com (Gary Bloom) Date: Wed, 10 Oct 2007 10:18:11 -0400 Subject: [Image-SIG] BUG: PIL DPI trouble - fix for TIFF files (PIL 1.1.6) Message-ID: Here's a quick fix for the writing of the file, as well... Before making the fix below, go to line 721 and change the '1' to a '2' ! 721: ifd[RESOLUTION_UNIT] = 1 becomes 721: ifd[RESOLUTION_UNIT] = 2 Then make the changes listed below. This is consistent with those changes. This is a quick and dirty fix that I have not tested extensively, but it quickly allows me to read and write TIFF images with both the PIL and Photoshop, and each can see the DPI as set by the other. It fixes the problem I've had with PIL reading/writing TIFFs. Thanks, Florian! Regards, Gary Bloom Sales Engineer Sefas Innovation www.sefas.com ============ [Image-SIG] BUG: PIL DPI trouble - fix for TIFF files (PIL 1.1.6) Florian H?ch lists+Image_SIG at hoech.org Fri Oct 5 00:05:16 CEST 2007 a.. Previous message: [Image-SIG] fromstring image question b.. Next message: [Image-SIG] Image transpose c.. Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] -------------------------------------------------------------------------------- PIL only adds a dpi entry in the info dictionary if no resolution unit is specified in the TIFF file. This seems to be because of a misinterpretation of resolution unit values: they have a different meaning than in a JPEG file. JPEG: 0 = None; 1 = inches; 2 = cm. TIFF: 1 = None; 2 = inches; 3 = cm (see http://www.awaresystems.be/imaging/tiff/tifftags/resolutionunit.html and http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/JPEG.html) Here's a quick fix: Open TiffImagePlugin.py and go to line 577. Change the code: xres = getscalar(X_RESOLUTION, (1, 1)) yres = getscalar(Y_RESOLUTION, (1, 1)) if xres and yres: xres = xres[0] / (xres[1] or 1) yres = yres[0] / (yres[1] or 1) resunit = getscalar(RESOLUTION_UNIT, 1) if resunit == 2: # Inches self.info["dpi"] = xres, yres elif resunit == 3: # Centimeters self.info["dpi"] = xres * 2.54, yres * 2.54 else: # No absolute unit of measurement. self.info["resolution"] = xres, yres Regards, Florian Hoech -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20071010/5903312a/attachment.htm From B.R.ten_Broeke at lumc.nl Thu Oct 11 13:41:09 2007 From: B.R.ten_Broeke at lumc.nl (B.R.ten_Broeke at lumc.nl) Date: Thu, 11 Oct 2007 13:41:09 +0200 Subject: [Image-SIG] how to read tif image Message-ID: Hello, How do I read a (I;16) TIFF image with PIL? If I use the basic code: im = Image.open("file.tif") im.show() My output is a white screen. If I open the image with ImageJ, I have no problems. Any suggestions? Thanx in advance. Bradley -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20071011/7184b10d/attachment.htm From tiptip.barish at gmail.com Sun Oct 14 04:18:03 2007 From: tiptip.barish at gmail.com (Varsha purohit) Date: Sat, 13 Oct 2007 19:18:03 -0700 Subject: [Image-SIG] Help needed for converting ascii data to image Message-ID: <9636adca0710131918k87aff12m59c20c76ebe2d237@mail.gmail.com> Hello, I need a sample program to use frombuffer or something like that to convert my ascii text file to image file. Can anybody please share the information. thanks, Rani -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20071013/5289c3a3/attachment.htm From Chris.Barker at noaa.gov Wed Oct 17 19:17:41 2007 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Wed, 17 Oct 2007 10:17:41 -0700 Subject: [Image-SIG] Help needed for converting ascii data to image In-Reply-To: <9636adca0710131918k87aff12m59c20c76ebe2d237@mail.gmail.com> References: <9636adca0710131918k87aff12m59c20c76ebe2d237@mail.gmail.com> Message-ID: <471643B5.9020806@noaa.gov> Varsha purohit wrote: > I need a sample program to use frombuffer frombuffer is for converting binary data to an image. > convert my ascii text file to image file. What form is your ascii text file? You can parse it on your own, or the numpy package (see numpy.fromfile) may help. In any case, you'll need a way to convert your ascii text to a binary format that PIL understands. -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 hohmannm at mail.nih.gov Thu Oct 18 15:46:08 2007 From: hohmannm at mail.nih.gov (Hohmann-Marriott, Martin (NIH/NIBIB) [V]) Date: Thu, 18 Oct 2007 09:46:08 -0400 Subject: [Image-SIG] problem with Image.open and Image.save Message-ID: <52DA0C32CA887A46BE35E26F2E2F7DF7E5BBEB@NIHCESMLBX3.nih.gov> Hi there, I try to open, (manipulate) and save an image, but run into problems on a "once in a while basis". My suspicion is that it has something to do with file access - so I made sure the image (new.tif) is not opened by any other program. Any suggestions for a work around. CODE: import Image im=Image.open("new.tif") im.save("new.tif") ERROR REPORT: Traceback (most recent call last): File "C:\Python24\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 310, in RunScript exec codeObject in __main__.__dict__ File "I:\synthetic\Script1.py", line 4, in ? im.save("new.tif") File "C:\Python24\Lib\site-packages\PIL\Image.py", line 1399, in save fp = __builtin__.open(fp, "wb") IOError: [Errno 13] Permission denied: 'new.tif' Thank you for your help! Martin From markolopa at gmail.com Thu Oct 18 17:37:08 2007 From: markolopa at gmail.com (Marko Loparic) Date: Thu, 18 Oct 2007 17:37:08 +0200 Subject: [Image-SIG] simple image editor Message-ID: Hi, I am looking for a simple image editing program matcing the following characteristics: - includes 3 functions: cut, brightness control and contrast control (nothing else needed). - be very easy to use: it is an educational software for children in regions with low scolarity. That is why we don't use existing image editors. - written prefarably in Python, but in any other language if better libraries exist. - runs on Windows and Linux. - preferably that runs inside the browser. I think this is not possible with python, we should have to use javascript (?) The application will be part of a cdrom. No network/internet interaction exists. The rest of the application will run inside a browser (running flash), that is why it would be better if the image editor could run inside the browser as well. Thank you very much in advance, Marko From wbsmith at gmail.com Wed Oct 17 16:45:25 2007 From: wbsmith at gmail.com (W. Bryan Smith) Date: Wed, 17 Oct 2007 07:45:25 -0700 Subject: [Image-SIG] how to read tif image In-Reply-To: References: Message-ID: if i remember correctly, pil doesn't deal with 16-bit tif. i think there was a patch around or something.... anyone have the info on this? tif does have a very specific header, including an offset (in bytes) to the image pixels, so it should be pretty easy to use a binary read operation to get your pixels. On 10/11/07, B.R.ten_Broeke at lumc.nl wrote: > > Hello, > > > > How do I read a (I;16) TIFF image with PIL? > > If I use the basic code: > > im = Image.open("file.tif") > > im.show() > > My output is a white screen. If I open the image with ImageJ, I have no > problems. > > > > Any suggestions? > > Thanx in advance. > > > > Bradley > > _______________________________________________ > 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/20071017/b95d5c11/attachment.htm From kemmerling at gmx.at Thu Oct 18 09:50:49 2007 From: kemmerling at gmx.at (Markus Kemmerling) Date: Thu, 18 Oct 2007 09:50:49 +0200 Subject: [Image-SIG] BUG: PIL DPI trouble - fix for TIFF files (PIL 1.1.6) In-Reply-To: References: Message-ID: <632DE642-17E4-49A9-9139-A59AF770D780@gmx.at> I would really like to see these fixes included in a next PIL release, if there will be one. (I also would like to see an egg release, but that's a different story.) Note, that I posted a similar fix (combining Florian's and your's) to the list a long time ago (july 2006). There is a small difference though, see below. Maybe a test for these fixes should be added, but I can't see any TIFF image tests at all in the PIL distribution. Am 10.10.2007 um 16:18 schrieb Gary Bloom: > Here's a quick fix for the writing of the file, as well... > > Before making the fix below, go to line 721 and change the '1' to a > '2' ! > > 721: ifd[RESOLUTION_UNIT] = 1 > > becomes > > 721: ifd[RESOLUTION_UNIT] = 2 > > Then make the changes listed below. This is consistent with > those changes. This is a quick and dirty fix that I have not > tested extensively, but it quickly allows me to read and write TIFF > images with both the PIL and Photoshop, and each can see the DPI as > set by the other. It fixes the problem I've had with PIL reading/ > writing TIFFs. Thanks, Florian! > > Regards, > > Gary Bloom > Sales Engineer > Sefas Innovation > www.sefas.com > ============ > [Image-SIG] BUG: PIL DPI trouble - fix for TIFF files (PIL 1.1.6) > > Florian H?ch lists+Image_SIG at hoech.org > Fri Oct 5 00:05:16 CEST 2007 > > Previous message: [Image-SIG] fromstring image question > Next message: [Image-SIG] Image transpose > Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] > PIL only adds a dpi entry in the info dictionary if no resolution unit > is specified in the TIFF file. This seems to be because of a > misinterpretation of resolution unit values: they have a different > meaning than in a JPEG file. JPEG: 0 = None; 1 = inches; 2 = cm. > TIFF: 1 > = None; 2 = inches; 3 = cm (see > http://www.awaresystems.be/imaging/tiff/tifftags/ > resolutionunit.html and > http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/JPEG.html) > > Here's a quick fix: > > Open TiffImagePlugin.py and go to line 577. Change the code: > > xres = getscalar(X_RESOLUTION, (1, 1)) > yres = getscalar(Y_RESOLUTION, (1, 1)) > > if xres and yres: > xres = xres[0] / (xres[1] or 1) > yres = yres[0] / (yres[1] or 1) > resunit = getscalar(RESOLUTION_UNIT, 1) > if resunit == 2: # Inches > self.info["dpi"] = xres, yres > elif resunit == 3: # Centimeters > self.info["dpi"] = xres * 2.54, yres * 2.54 When converting from inches to centimeters, shouldn't you rather divide by 2.54 instead of multiplying? > > else: # No absolute unit of measurement. > self.info["resolution"] = xres, yres > > > Regards, > > Florian Hoech > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig Regards, Markus Kemmerling -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20071018/fe5b7e1d/attachment.htm From joanca at casasin.com Fri Oct 19 16:04:44 2007 From: joanca at casasin.com (=?ISO-8859-1?Q?Joancarles_Casas=EDn?=) Date: Fri, 19 Oct 2007 16:04:44 +0200 Subject: [Image-SIG] Too many opened images Message-ID: <53D4EC7F-DF76-4AD3-8107-8B5575A34444@casasin.com> Hi, Is there any way to deal with the "Too many opened images" error? I mean, I've a script which opens a (huge) bunch of images, crops a part and adds it to a resulting image. When the process has been done with around 200 images the script raises the "Too many opened images" Error. Can I manage this? Thanks, Joancarles ????????????????? www.casasin.com ????????????????? From nadavh at visionsense.com Mon Oct 22 07:59:28 2007 From: nadavh at visionsense.com (Nadav Horesh) Date: Mon, 22 Oct 2007 07:59:28 +0200 Subject: [Image-SIG] how to read tif image Message-ID: <710F2847B0018641891D9A21602763600B6E0F@ex3.envision.co.il> I did use PIL to read/write 16 bit images (could be also 32 bits, but I am not sure) Nadav. -----Original Message----- From: image-sig-bounces at python.org on behalf of W. Bryan Smith Sent: Wed 17-Oct-07 16:45 To: B.R.ten_Broeke at lumc.nl Cc: Image-SIG at python.org Subject: Re: [Image-SIG] how to read tif image if i remember correctly, pil doesn't deal with 16-bit tif. i think there was a patch around or something.... anyone have the info on this? tif does have a very specific header, including an offset (in bytes) to the image pixels, so it should be pretty easy to use a binary read operation to get your pixels. On 10/11/07, B.R.ten_Broeke at lumc.nl wrote: > > Hello, > > > > How do I read a (I;16) TIFF image with PIL? > > If I use the basic code: > > im = Image.open("file.tif") > > im.show() > > My output is a white screen. If I open the image with ImageJ, I have no > problems. > > > > Any suggestions? > > Thanx in advance. > > > > Bradley > > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > > From nadavh at visionsense.com Mon Oct 22 12:30:52 2007 From: nadavh at visionsense.com (Nadav Horesh) Date: Mon, 22 Oct 2007 12:30:52 +0200 Subject: [Image-SIG] how to read tif image Message-ID: <710F2847B0018641891D9A21602763600B6E15@ex3.envision.co.il> The 16 bit mode in not supported well (or not at all) via the array interface, so way I use it is via the good old buffer/string interface: >>> from numpy import * >>> import Image >>> a = arange(65536, dtype=uint16).reshape(256, 256) >>> a.shape (256, 256) >>> ima = Image.frombuffer('I;16', [256,256], a.data) Warning (from warnings module): File "__main__", line 1 RuntimeWarning: the frombuffer defaults may change in a future release; for portability, change the call to read: frombuffer(mode, size, data, 'raw', mode, 0, 1) >>> ima.save('16bits.tif') >>> imb = Image.open('16bits.tif') >>> stb = imb.tostring() >>> len(stb) 131072 >>> b = fromstring(stb, dtype=uint16).reshape(256, 256) >>> b.max() 65535 -----Original Message----- From: B.R.ten_Broeke at lumc.nl [mailto:B.R.ten_Broeke at lumc.nl] Sent: Mon 22-Oct-07 08:54 To: Nadav Horesh Subject: RE: [Image-SIG] how to read tif image How did you read the Images? Bradley -----Oorspronkelijk bericht----- Van: Nadav Horesh [mailto:nadavh at visionsense.com] Verzonden: Monday, October 22, 2007 7:59 AM Aan: W. Bryan Smith; Broeke, B.R. ten (LKEB) CC: Image-SIG at python.org Onderwerp: RE: [Image-SIG] how to read tif image I did use PIL to read/write 16 bit images (could be also 32 bits, but I am not sure) Nadav. -----Original Message----- From: image-sig-bounces at python.org on behalf of W. Bryan Smith Sent: Wed 17-Oct-07 16:45 To: B.R.ten_Broeke at lumc.nl Cc: Image-SIG at python.org Subject: Re: [Image-SIG] how to read tif image if i remember correctly, pil doesn't deal with 16-bit tif. i think there was a patch around or something.... anyone have the info on this? tif does have a very specific header, including an offset (in bytes) to the image pixels, so it should be pretty easy to use a binary read operation to get your pixels. On 10/11/07, B.R.ten_Broeke at lumc.nl wrote: > > Hello, > > > > How do I read a (I;16) TIFF image with PIL? > > If I use the basic code: > > im = Image.open("file.tif") > > im.show() > > My output is a white screen. If I open the image with ImageJ, I have no > problems. > > > > Any suggestions? > > Thanx in advance. > > > > Bradley > > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > > From leknarf at pacbell.net Tue Oct 23 22:57:23 2007 From: leknarf at pacbell.net (Scott Frankel) Date: Tue, 23 Oct 2007 13:57:23 -0700 Subject: [Image-SIG] freetype installation questions Message-ID: Hi, I'm attempting to build PIL on a MacOSX box and python setup.py is failing on freetype2. I installed Fink on this machine in order to get freetype2 and the jpeg libraries. My understanding of Fink and its use is only a couple hours old. ;) In PIL's set.py script, I've tried setting the FREETYPE var to explicitly point to the fink lib install. eg: FREETYPE_ROOT = "/sw/lib/" and FREETYPE_ROOT = "/sw/lib/libfreetype.6.dylib" Is this correct? (libfreetype.6.dylib exists at that location and is read/writable.) Fink also installed: /sw/lib/freetype2/lib/ libfreetype.a libfreetype.la Thanks in advance for any suggestions on getting PIL to build properly. Scott PIL v1.1.6 Python v2.4.1 MacOSX v10.4.9 Fink v0.8.1 [ cmd-line ] % python setup.py build_ext -i [ yields ] -------------------------------------------------------------------- PIL 1.1.6 BUILD SUMMARY -------------------------------------------------------------------- version 1.1.6 platform darwin 2.4.1 (#2, Mar 31 2005, 00:05:10) [GCC 3.3 20030304 (Apple Computer, Inc. build 1666)] -------------------------------------------------------------------- --- TKINTER support ok --- JPEG support ok --- ZLIB (PNG/ZIP) support ok *** FREETYPE2 support not available From leknarf at pacbell.net Wed Oct 24 02:08:45 2007 From: leknarf at pacbell.net (Scott Frankel) Date: Tue, 23 Oct 2007 17:08:45 -0700 Subject: [Image-SIG] _imagingft for OSX Message-ID: <1B54E573-9C0F-40D2-A8A2-5323CCE84A4F@pacbell.net> Finally got PIL to build and install without error. Stuck now on using the ImageFont module. Where do I get _imagingft? How is it built and installed? Thanks again! Scott From felipe.gomes.ferreira at gmail.com Mon Oct 22 13:01:32 2007 From: felipe.gomes.ferreira at gmail.com (Felipe Gomes Vieira Ferreira) Date: Mon, 22 Oct 2007 08:01:32 -0300 Subject: [Image-SIG] Problem compiling PIL on Linux Message-ID: <49f610bb0710220401l15eaff78h5720ea3e3496d713@mail.gmail.com> Hi. I have just downloaded python pil, and when i try to compile it generate a lot off errors: python setup.py build_ext -i running build_ext building '_imaging' extension gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O2 -Wall -Wstrict-prototypes -fPIC -DHAVE_LIBJPEG -DHAVE_LIBZ -I/usr/include/freetype2 -IlibImaging -I/usr/include -I/usr/local/include -I/usr/include/python2.4 -c _imaging.c -o build/temp.linux-i686-2.4/_imaging.o _imaging.c:76:20: error: Python.h: No such file or directory In file included from libImaging/Imaging.h:14, from _imaging.c:78: libImaging/ImPlatform.h:10:20: error: Python.h: No such file or directory libImaging/ImPlatform.h:14:2: error: #error Sorry, this library requires support for ANSI prototypes. libImaging/ImPlatform.h:17:2: error: #error Sorry, this library requires ANSI header files. libImaging/ImPlatform.h:55:2: error: #error Cannot find required 32-bit integer type In file included from _imaging.c:78: libImaging/Imaging.h:90: error: expected specifier-qualifier-list before 'INT32' libImaging/Imaging.h:265: error: expected specifier-qualifier-list before 'INT32' libImaging/Imaging.h:393: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'ImagingCRC32' _imaging.c:123: error: expected specifier-qualifier-list before 'PyObject_HEAD' _imaging.c:127: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'PyTypeObject' _imaging.c:141: error: expected specifier-qualifier-list before 'PyObject_HEAD' _imaging.c:149: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'PyTypeObject' _imaging.c:152: error: expected specifier-qualifier-list before 'PyObject_HEAD' _imaging.c:158: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'PyTypeObject' _imaging.c:163: error: expected specifier-qualifier-list before 'PyObject_HEAD' _imaging.c:168: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'PyTypeObject' _imaging.c:170: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c: In function '_dealloc': _imaging.c:201: error: 'ImagingObject' has no member named 'image' _imaging.c:202: warning: implicit declaration of function 'PyMem_DEL' _imaging.c: At top level: _imaging.c:207: error: expected ')' before '*' token _imaging.c: In function 'ImagingSectionEnter': _imaging.c:225: error: 'PyThreadState' undeclared (first use in this function) _imaging.c:225: error: (Each undeclared identifier is reported only once _imaging.c:225: error: for each function it appears in.) _imaging.c:225: error: expected expression before ')' token _imaging.c: In function 'ImagingSectionLeave': _imaging.c:232: warning: implicit declaration of function 'PyEval_RestoreThread' _imaging.c:232: error: 'PyThreadState' undeclared (first use in this function) _imaging.c:232: error: expected expression before ')' token _imaging.c: In function 'ImagingError_IOError': _imaging.c:253: warning: implicit declaration of function 'PyErr_SetString' _imaging.c:253: error: 'PyExc_IOError' undeclared (first use in this function) _imaging.c:254: error: 'NULL' undeclared (first use in this function) _imaging.c: In function 'ImagingError_MemoryError': _imaging.c:260: warning: implicit declaration of function 'PyErr_NoMemory' _imaging.c:260: warning: return makes pointer from integer without a cast _imaging.c: In function 'ImagingError_Mismatch': _imaging.c:266: error: 'PyExc_ValueError' undeclared (first use in this function) _imaging.c:267: error: 'NULL' undeclared (first use in this function) _imaging.c: In function 'ImagingError_ModeError': _imaging.c:273: error: 'PyExc_ValueError' undeclared (first use in this function) _imaging.c:274: error: 'NULL' undeclared (first use in this function) _imaging.c: In function 'ImagingError_ValueError': _imaging.c:281: error: 'PyExc_ValueError' undeclared (first use in this function) _imaging.c:284: error: 'NULL' undeclared (first use in this function) _imaging.c: At top level: _imaging.c:316: error: expected ')' before '*' token _imaging.c:413: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:468: error: expected ')' before '*' token _imaging.c:536: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:568: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:580: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:592: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:604: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:613: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:624: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:635: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:646: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:668: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:692: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:709: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:726: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:735: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:752: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:762: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:773: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:805: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:840: error: expected ')' before '*' token _imaging.c:880: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:902: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:975: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:986: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:996: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:1035: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:1112: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:1123: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:1260: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:1280: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:1315: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:1340: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:1371: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:1382: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:1402: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:1453: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:1485: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:1531: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:1606: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:1657: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:1663: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:1675: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:1709: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:1737: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:1767: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:1778: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:1794: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:1815: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:1821: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:1832: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:1843: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:1854: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:1865: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:1876: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:1894: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:1912: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:1923: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:1934: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:1945: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:1956: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:1974: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c: In function '_font_dealloc': _imaging.c:2035: warning: implicit declaration of function 'Py_XDECREF' _imaging.c:2035: error: 'ImagingFontObject' has no member named 'ref' _imaging.c: In function 'textwidth': _imaging.c:2045: error: 'ImagingFontObject' has no member named 'glyphs' _imaging.c: At top level: _imaging.c:2050: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:2098: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:2108: error: array type has incomplete element type _imaging.c:2109: error: 'PyCFunction' undeclared here (not in a function) _imaging.c:2109: error: expected '}' before '_font_getmask' _imaging.c:2110: error: expected '}' before '_font_getsize' _imaging.c:2111: error: 'NULL' undeclared here (not in a function) _imaging.c:2114: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:2122: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c: In function '_draw_dealloc': _imaging.c:2150: error: 'ImagingDrawObject' has no member named 'image' _imaging.c: At top level: _imaging.c:2154: error: expected ')' before '*' token _imaging.c:2156: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:2171: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:2191: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:2228: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:2246: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:2283: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:2299: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:2352: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:2367: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:2400: error: expected ')' before '*' token _imaging.c:2402: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:2429: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:2447: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:2493: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:2530: error: array type has incomplete element type _imaging.c:2533: error: expected '}' before '_draw_line' _imaging.c:2534: error: expected '}' before '_draw_lines' _imaging.c:2536: error: expected '}' before '_draw_outline' _imaging.c:2538: error: expected '}' before '_draw_polygon' _imaging.c:2539: error: expected '}' before '_draw_rectangle' _imaging.c:2540: error: expected '}' before '_draw_point' _imaging.c:2541: error: expected '}' before '_draw_points' _imaging.c:2542: error: expected '}' before '_draw_arc' _imaging.c:2543: error: expected '}' before '_draw_bitmap' _imaging.c:2544: error: expected '}' before '_draw_chord' _imaging.c:2545: error: expected '}' before '_draw_ellipse' _imaging.c:2546: error: expected '}' before '_draw_pieslice' _imaging.c:2547: error: expected '}' before '_draw_ink' _imaging.c:2552: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:2561: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c: In function 'pixel_access_dealloc': _imaging.c:2586: error: 'PixelAccessObject' has no member named 'image' _imaging.c: At top level: _imaging.c:2590: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:2601: error: expected declaration specifiers or '...' before 'PyObject' _imaging.c:2601: error: expected declaration specifiers or '...' before 'PyObject' _imaging.c: In function 'pixel_access_setitem': _imaging.c:2603: error: 'PixelAccessObject' has no member named 'image' _imaging.c:2607: error: 'PixelAccessObject' has no member named 'readonly' _imaging.c:2612: warning: implicit declaration of function '_getxy' _imaging.c:2612: error: 'xy' undeclared (first use in this function) _imaging.c:2616: error: 'PyExc_IndexError' undeclared (first use in this function) _imaging.c:2620: error: 'color' undeclared (first use in this function) _imaging.c:2623: warning: implicit declaration of function 'getink' _imaging.c:2629: error: 'struct ImagingMemoryInstance' has no member named 'image32' _imaging.c:2629: error: 'INT32' undeclared (first use in this function) _imaging.c:2629: error: expected expression before ')' token _imaging.c: At top level: _imaging.c:2640: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:2659: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:2670: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:2687: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:2707: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:2742: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:2763: error: array type has incomplete element type _imaging.c:2766: error: expected '}' before '_getpixel' _imaging.c:2767: error: expected '}' before '_putpixel' _imaging.c:2769: error: expected '}' before 'pixel_access_new' _imaging.c:2772: error: expected '}' before '_convert' _imaging.c:2773: error: expected '}' before '_convert2' _imaging.c:2774: error: expected '}' before '_convert_matrix' _imaging.c:2775: error: expected '}' before '_copy' _imaging.c:2776: error: expected '}' before '_copy2' _imaging.c:2780: error: expected '}' before '_crop' _imaging.c:2781: error: expected '}' before '_expand' _imaging.c:2782: error: expected '}' before '_filter' _imaging.c:2783: error: expected '}' before '_histogram' _imaging.c:2785: error: expected '}' before '_modefilter' _imaging.c:2787: error: expected '}' before '_offset' _imaging.c:2788: error: expected '}' before '_paste' _imaging.c:2789: error: expected '}' before '_point' _imaging.c:2790: error: expected '}' before '_point_transform' _imaging.c:2791: error: expected '}' before '_putdata' _imaging.c:2793: error: expected '}' before '_quantize' _imaging.c:2796: error: expected '}' before '_rankfilter' _imaging.c:2798: error: expected '}' before '_resize' _imaging.c:2799: error: expected '}' before '_rotate' _imaging.c:2800: error: expected '}' before '_stretch' _imaging.c:2801: error: expected '}' before '_transpose' _imaging.c:2802: error: expected '}' before '_transform2' _imaging.c:2804: error: expected '}' before '_isblock' _imaging.c:2806: error: expected '}' before '_getbbox' _imaging.c:2807: error: expected '}' before '_getcolors' _imaging.c:2808: error: expected '}' before '_getextrema' _imaging.c:2809: error: expected '}' before '_getprojection' _imaging.c:2811: error: expected '}' before '_getband' _imaging.c:2812: error: expected '}' before '_putband' _imaging.c:2813: error: expected '}' before '_fillband' _imaging.c:2815: error: expected '}' before 'im_setmode' _imaging.c:2817: error: expected '}' before '_getpalette' _imaging.c:2818: error: expected '}' before '_putpalette' _imaging.c:2819: error: expected '}' before '_putpalettealpha' _imaging.c:2823: error: expected '}' before '_chop_invert' _imaging.c:2824: error: expected '}' before '_chop_lighter' _imaging.c:2825: error: expected '}' before '_chop_darker' _imaging.c:2826: error: expected '}' before '_chop_difference' _imaging.c:2827: error: expected '}' before '_chop_multiply' _imaging.c:2828: error: expected '}' before '_chop_screen' _imaging.c:2829: error: expected '}' before '_chop_add' _imaging.c:2830: error: expected '}' before '_chop_subtract' _imaging.c:2831: error: expected '}' before '_chop_add_modulo' _imaging.c:2832: error: expected '}' before '_chop_subtract_modulo' _imaging.c:2833: error: expected '}' before '_chop_and' _imaging.c:2834: error: expected '}' before '_chop_or' _imaging.c:2835: error: expected '}' before '_chop_xor' _imaging.c:2840: error: expected '}' before '_effect_spread' _imaging.c:2844: error: expected '}' before '_new_array' _imaging.c:2845: error: expected '}' before '_new_block' _imaging.c:2848: error: expected '}' before '_save_ppm' _imaging.c:2857: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c: In function 'image_length': _imaging.c:2886: error: 'ImagingObject' has no member named 'image' _imaging.c: At top level: _imaging.c:2891: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:2906: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'image_as_sequence' _imaging.c:2919: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'PyTypeObject' _imaging.c:2940: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'PyTypeObject' _imaging.c:2952: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'PyTypeObject' _imaging.c:2966: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'pixel_access_as_mapping' _imaging.c:2974: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'PyTypeObject' _imaging.c:2996: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:2997: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:2998: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:2999: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:3000: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:3001: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:3002: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:3003: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:3004: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:3005: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:3006: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:3007: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:3008: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:3009: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:3010: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:3013: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:3014: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:3015: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:3016: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:3017: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:3018: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:3019: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:3033: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:3036: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:3038: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:3039: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token _imaging.c:3041: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'functions' _imaging.c:3138: warning: return type defaults to 'int' _imaging.c: In function 'DL_EXPORT': _imaging.c:3138: error: expected declaration specifiers before 'init_imaging' _imaging.c:3149: error: expected '{' at end of input error: command 'gcc' failed with exit status 1 python Python 2.4.4 (#2, Apr 26 2007, 00:02:45) [GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux gcc --version gcc (GCC) 4.1.3 20070831 (prerelease) (Debian 4.1.2-16) Is it Python.h missing? Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20071022/481699af/attachment-0001.htm From nish_ramiad at hotmail.com Wed Oct 24 10:38:30 2007 From: nish_ramiad at hotmail.com (nish Ramiad) Date: Wed, 24 Oct 2007 12:38:30 +0400 Subject: [Image-SIG] transparency Message-ID: hi..... i've made an application using tkinter where my image should be transparent. can you please help me to do it. thnx you _________________________________________________________________ Invite your mail contacts to join your friends list with Windows Live Spaces. It's easy! http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20071024/277934ab/attachment.htm From michele.petrazzo at unipex.it Wed Oct 24 21:19:10 2007 From: michele.petrazzo at unipex.it (Michele Petrazzo - Unipex srl) Date: Wed, 24 Oct 2007 21:19:10 +0200 Subject: [Image-SIG] problem with Image.open and Image.save In-Reply-To: <52DA0C32CA887A46BE35E26F2E2F7DF7E5BBEB@NIHCESMLBX3.nih.gov> References: <52DA0C32CA887A46BE35E26F2E2F7DF7E5BBEB@NIHCESMLBX3.nih.gov> Message-ID: <471F9AAE.8040302@unipex.it> Hohmann-Marriott, Martin (NIH/NIBIB) [V] wrote: > Hi there, > > I try to open, (manipulate) and save an image, but run into problems > on a "once in a while basis". My suspicion is that it has something > to do with file access - so I made sure the image (new.tif) is not > opened by any other program. Any suggestions for a work around. > > CODE: import Image > > im=Image.open("new.tif") im.save("new.tif") > This because you are trying to save on the same file! There is a problem if no error are raised! im=Image.open("new.tif") im.save("new_tmp.tif") # or tempfile.mkstemp for a real temp file del im os.remove("new.tif") os.rename("new_tmp.tif", "new.tif) Michele From michele.petrazzo at unipex.it Wed Oct 24 21:23:31 2007 From: michele.petrazzo at unipex.it (Michele Petrazzo - Unipex srl) Date: Wed, 24 Oct 2007 21:23:31 +0200 Subject: [Image-SIG] Too many opened images In-Reply-To: <53D4EC7F-DF76-4AD3-8107-8B5575A34444@casasin.com> References: <53D4EC7F-DF76-4AD3-8107-8B5575A34444@casasin.com> Message-ID: <471F9BB3.6070003@unipex.it> Joancarles Casas?n wrote: > Hi, > > Is there any way to deal with the "Too many opened images" error? > > I mean, I've a script which opens a (huge) bunch of images, crops a > part and adds it to a resulting image. When the process has been > done with around 200 images the script raises the "Too many opened > images" Error. Can I manage this? Are you sure that this are a PIL problem? michele:~/tmp/Imaging-1.1.6$ grep -R -i "Too many" * _imaging.c: PyErr_SetString(PyExc_TypeError, "too many data entries"); PIL/Image.py: raise ValueError("Too many dimensions.") michele:~/tmp/Imaging-1.1.6$ Like you can see, inside the last PIL sources, no "Too many opened images" string are found! However a solution, for me, can be to create an external python script that do something you want with the image and after it'll be close. For do this, you have to deal with the subprocess lib. Michele From michele.petrazzo at unipex.it Wed Oct 24 21:13:47 2007 From: michele.petrazzo at unipex.it (Michele Petrazzo - Unipex srl) Date: Wed, 24 Oct 2007 21:13:47 +0200 Subject: [Image-SIG] Problem compiling PIL on Linux In-Reply-To: <49f610bb0710220401l15eaff78h5720ea3e3496d713@mail.gmail.com> References: <49f610bb0710220401l15eaff78h5720ea3e3496d713@mail.gmail.com> Message-ID: <471F996B.4050708@unipex.it> Felipe Gomes Vieira Ferreira wrote: > Hi. I have just downloaded python pil, and when i try to compile it > generate a lot off errors: > Follow those pass: your_package_manager install python-image (in debian, apt-get install python-imaging, in fedora yum install ....) OR your_package_manager install python-dev make && make install and yes, you need Python.h :) Michele From Chris.Barker at noaa.gov Wed Oct 24 22:16:16 2007 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Wed, 24 Oct 2007 13:16:16 -0700 Subject: [Image-SIG] freetype installation questions In-Reply-To: References: Message-ID: <471FA810.4090309@noaa.gov> Scott Frankel wrote: > I'm attempting to build PIL on a MacOSX box Did you try using the one here: http://pythonmac.org/packages If you do need to build your own, I think there are instructions about how that one was built on the wiki. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker at noaa.gov From leknarf at pacbell.net Thu Oct 25 00:43:16 2007 From: leknarf at pacbell.net (Scott Frankel) Date: Wed, 24 Oct 2007 15:43:16 -0700 Subject: [Image-SIG] freetype installation questions In-Reply-To: <471FA810.4090309@noaa.gov> References: <471FA810.4090309@noaa.gov> Message-ID: Wonderful! Thanks for the tip - Scott On Oct 24, 2007, at 1:16 PM, Christopher Barker wrote: > > > Scott Frankel wrote: >> I'm attempting to build PIL on a MacOSX box > > Did you try using the one here: > > http://pythonmac.org/packages > > If you do need to build your own, I think there are instructions > about how that one was built on the wiki. > > -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 cardona at ucla.edu Sun Oct 28 23:09:29 2007 From: cardona at ucla.edu (Albert Cardona) Date: Sun, 28 Oct 2007 15:09:29 -0700 Subject: [Image-SIG] simple image editor In-Reply-To: References: Message-ID: <47250899.4090607@ucla.edu> Hi Marko, Have a look at ImageJ and ImageJA (applet): ImageJA: http://imageja.sourceforge.net ImageJ: http://rsb.info.nih.gov/ij Albert -- Albert Cardona http://www.mcdb.ucla.edu/Research/Hartenstein/acardona From mvriens at microsystem.cl Mon Oct 29 22:01:04 2007 From: mvriens at microsystem.cl (Marijn Vriens) Date: Mon, 29 Oct 2007 18:01:04 -0300 Subject: [Image-SIG] PIL and TIFF Group 4 decoder support Message-ID: <4020f19d0710291401h67650076ldcdf056fdb56742d@mail.gmail.com> Listers, I have been at this problem for a couple of hours now, and I'm at a loss. I need to get PIL working with TIFF files that have the group4 encoding ( : decoder group4 not available ) . Googling around I found some patches (from 2003!) that add support for this to PIL. But it doesn't patch well against PIL 1.1.6. I found a newer patch ( http://static.wiredfool.com/Imaging-1.1.6-group4.patch ) but that doesn't seem to work against libtiff 3.8.2. I also installed the libtiff4-dev, but the PIL compile still complains about a missing tiffiop.h file Somehow I have the feeling I'm going about it all wrong. should it be this hard to get support for a well known format like TIFF in PIL? Any hints to get proper TIFF support in PIL? I'm running Ubuntu 7.10 (Gutsy) on i686 with python 2.5, PIL 1.1.6 and 3.8.2-7ubuntu2 . Regards, Marijn Vriens. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20071029/78be83a5/attachment.htm