From cpu.crazy at gmail.com Sat Jul 2 04:38:45 2005 From: cpu.crazy at gmail.com (Joseph Quigley) Date: Fri, 1 Jul 2005 20:38:45 -0600 Subject: [Image-SIG] Something other than .show() Message-ID: <66ca60fc05070119384b7933fd@mail.gmail.com> What else can I use besides .show() to display the image? I don't mind xv but on Windows it takes forever to load the picture. Is there an alternative? I found the PIL handbook but I can't find anything other than .show() Thanks, Joe From Chris.Barker at noaa.gov Sat Jul 2 08:03:04 2005 From: Chris.Barker at noaa.gov (Chris Barker) Date: Fri, 01 Jul 2005 23:03:04 -0700 Subject: [Image-SIG] Something other than .show() In-Reply-To: <66ca60fc05070119384b7933fd@mail.gmail.com> References: <66ca60fc05070119384b7933fd@mail.gmail.com> Message-ID: <42C62E18.8090006@noaa.gov> Joseph Quigley wrote: > What else can I use besides .show() to display the image? PIL can be used with any number of the various GUI toolkits available for Python. Here's some info about using it with wxPython: http://wiki.wxpython.org/index.cgi/WorkingWithImages It would be pretty quick to whip up an alternative to show() with wxPython and probably any of the other major toolkits. (GTK, QT, etc.) -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker at noaa.gov From kevin at cazabon.com Sat Jul 2 10:31:49 2005 From: kevin at cazabon.com (kevin@cazabon.com) Date: Sat, 2 Jul 2005 10:31:49 +0200 Subject: [Image-SIG] Something other than .show() References: <66ca60fc05070119384b7933fd@mail.gmail.com> Message-ID: <001101c57ee0$8d1ed7b0$640aa8c0@duallie> You can write your own Tkinter widget pretty easily... (untested pseudocode) -------------- import Image, ImageTk, Tkinter def show2(imgFile): im = Image.open(imgFile) window = Tkinter.Tk() window.tkIm = ImageTk.PhotoImage(im) window.label = Tkinter.Label(window, image=window.tkIm) window.label.pack() return window x = show2("c:\\temp\test.tif") x.mainloop() --------------------- (I make the label and tkIm as attributes of the window class, so that a reference is held... otherwise garbage collection makes them go away) Kevin. ----- Original Message ----- From: "Joseph Quigley" To: Sent: Saturday, July 02, 2005 4:38 AM Subject: [Image-SIG] Something other than .show() > What else can I use besides .show() to display the image? I don't mind > xv but on Windows it takes forever to load the picture. Is there an > alternative? I found the PIL handbook but I can't find anything other > than .show() > Thanks, > Joe > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > > > From cpu.crazy at gmail.com Sat Jul 2 18:24:11 2005 From: cpu.crazy at gmail.com (Joseph Quigley) Date: Sat, 2 Jul 2005 10:24:11 -0600 Subject: [Image-SIG] Something other than .show() In-Reply-To: <42C62E18.8090006@noaa.gov> References: <66ca60fc05070119384b7933fd@mail.gmail.com> <42C62E18.8090006@noaa.gov> Message-ID: <66ca60fc05070209245b867a66@mail.gmail.com> Thanks guys. This helps. I'll try the Tk version (I'm having problems installing wxPython on Linux right now. You say I should look at the enhancer.py in the scripts folder? I'll try the pseudocode you wrote. I have minimal experience with GUI (i started python in Feb. this year) but I have An Introduction to Tkinter by Fredik Lundh. Thanks again. Joe On 7/2/05, Chris Barker wrote: > Joseph Quigley wrote: > > What else can I use besides .show() to display the image? > > PIL can be used with any number of the various GUI toolkits available > for Python. Here's some info about using it with wxPython: > > http://wiki.wxpython.org/index.cgi/WorkingWithImages > > It would be pretty quick to whip up an alternative to show() with > wxPython and probably any of the other major toolkits. (GTK, QT, etc.) > > -Chris > > > -- > Christopher Barker, Ph.D. > Oceanographer > > NOAA/OR&R/HAZMAT (206) 526-6959 voice > 7600 Sand Point Way NE (206) 526-6329 fax > Seattle, WA 98115 (206) 526-6317 main reception > > Chris.Barker at noaa.gov > From christianj at implicitnetworks.com Sat Jul 2 18:58:13 2005 From: christianj at implicitnetworks.com (Christian M. Jensen) Date: Sat, 2 Jul 2005 09:58:13 -0700 Subject: [Image-SIG] GUI with Transparency Message-ID: <326A1C8DE34E8E4189BE602CE79167840949DE@corporate.implicit.implicitnetworks.com> Hello, Does anyone know of a GUI toolkit that supports alpha blending using PNGs? Thanks! Christian From cpu.crazy at gmail.com Sat Jul 2 21:32:28 2005 From: cpu.crazy at gmail.com (Joseph Quigley) Date: Sat, 2 Jul 2005 13:32:28 -0600 Subject: [Image-SIG] Something other than .show() In-Reply-To: <42C62E18.8090006@noaa.gov> References: <66ca60fc05070119384b7933fd@mail.gmail.com> <42C62E18.8090006@noaa.gov> Message-ID: <66ca60fc050702123275bc5298@mail.gmail.com> Thanks! You guys made this possible (well, a fast quick image loading possible). Here's my source code (the program's not finished but this works great): import Image import imghdr import ImageTk import os import Tkinter print "\n" * 100 print "Jimage Reader 1.0\n" def imgshow(file): im = Image.open(file) window = Tkinter.Tk() window.tkIm = ImageTk.PhotoImage(im) window.label = Tkinter.Label(window, image=window.tkIm) window.label.pack() window.info = Tkinter.Label(window, text="Jimage Reader 1.0 Displaying: " + os.getcwd() + os.sep + open.img_name) window.info.pack() window.mainloop() def help(): while True: ask = raw_input("Help>> ") # Displaying and image if "show" in ask: print """\nHow to display the picture. To display the picture, type 'dsp' (without the quotes) at the console.\n""" elif "display" in ask: print """\nHow to display the picture. To display the picture, type 'dsp' (without the quotes) at the console.\n""" elif "open" in ask: print """\nHow to display the picture. To display the picture, type 'dsp' (without the quotes) at the console.\n""" elif "see" in ask: print """\nHow to display the picture. To display the picture, type 'dsp' (without the quotes) at the console.\n""" # Rotating an image. elif "flip" in ask: print """\nHow to rotate an image. Type 'rotate' (without the quotes) at the console.\n""" elif "rotate" in ask: print """\nHow to rotate an image. Type 'rotate' (without the quotes) at the console.\n""" elif "sideways" in ask: print """\nHow to rotate an image. Type 'rotate' (without the quotes) at the console.\n""" elif "upside down" in ask: print """\nHow to rotate an image. Type 'rotate' (without the quotes) at the console.\n""" elif ask == "back()": print "\n" * 100 break # Other stuff not found else: print "No help for your topic (%s) was found." % (ask) def quit(): raise SystemExit def save(): filename = raw_input("File name to save: ") if ".gif" or ".GIF" in filename: open.im.save(filename, "GIF") elif ".jpg" or ".jpeg" or ".JPG" or ".JPEG" in filename: open.im.save(filename, "JPEG") class open: while True: img_name = raw_input("\nImage name (including extention): ") try: img_name except KeyboardInterrupt: quit() except TypeError: quit() try: im = Image.open(img_name) except IOError: print "\nFile not found. Try again." continue print "\nFile loaded sucessfully.\n" break while True: m_m = raw_input("Jimage Console. Type 'h' for help.\n> ") try: m_m except KeyboardInterrupt: raise SystemExit if m_m == "help": help() elif m_m == "dsp": imgshow(open.img_name) elif m_m == "rotate": while True: try: angle = int(raw_input("\nRotate by: ")) except ValueError: print "Only digits are accepted. Eg: 180 instead of one hundred eighty." continue if ".gif" or ".GIF" in filename: open.im.rotate(angle).save("tmp", "GIF") elif ".jpg" or ".jpeg" or ".JPG" or ".JPEG" in filename: open.im.rotate(angle).save("tmp", "JPEG") imgshow("tmp") ok = raw_input("Is this ok? (Y/N): ") if ((ok == "Y") or ("y" == ok)): break else: continue while True: save = raw_input("Save? (Y/N): ") if ((save == "n") or ("N" == save)): break else: filename = raw_input("File name to save: ") if ".gif" or ".GIF" in filename: open.im.rotate(angle).save(filename, "GIF") elif ".jpg" or ".jpeg" or ".JPG" or ".JPEG" in filename: open.im.rotate(angle).save(filename, "JPEG") print "\n\n" break elif m_m == "open": while True: open.img_name = raw_input("\nImage name (including extention): ") try: open.img_name except KeyboardInterrupt: quit() except TypeError: quit() try: open.im = Image.open(open.img_name) except IOError: print "\nFile not found. Try again." continue print "\nFile loaded sucessfully.\n" break imgshow(open.img_name) elif m_m == "exit": quit() Thanks again, Joe From gwidion at mpc.com.br Sun Jul 3 03:48:13 2005 From: gwidion at mpc.com.br (Joao S. O. Bueno Calligaris) Date: Sat, 2 Jul 2005 22:48:13 -0300 Subject: [Image-SIG] Something other than .show() In-Reply-To: <66ca60fc05070119384b7933fd@mail.gmail.com> References: <66ca60fc05070119384b7933fd@mail.gmail.com> Message-ID: <200507022248.13419.gwidion@mpc.com.br> On Friday 01 July 2005 23:38, Joseph Quigley wrote: > What else can I use besides .show() to display the image? I don't > mind xv but on Windows it takes forever to load the picture. Is > there an alternative? I found the PIL handbook but I can't find > anything other than .show() > Thanks, > Joe Hi! PIL cannot do it by itself. However, Tkitner is largely distributed with Python - and is instaled by default in python for windows. So it is reasonably safe to create a Tkinter instance to display the image - even if your program uses another toolkit, the load should be less then xv. This was something I was wanting as well, so I crafted a small function which loads the needed modules and displays a new image. It can also work as a standallone lightweight "xv". Enjoy!! JS -><- -------------- next part -------------- A non-text attachment was scrubbed... Name: pyview.py Type: application/x-python Size: 1175 bytes Desc: not available Url : http://mail.python.org/pipermail/image-sig/attachments/20050702/17bb19f3/pyview.bin From Chris.Barker at noaa.gov Sun Jul 3 07:12:30 2005 From: Chris.Barker at noaa.gov (Chris Barker) Date: Sat, 02 Jul 2005 22:12:30 -0700 Subject: [Image-SIG] GUI with Transparency In-Reply-To: <326A1C8DE34E8E4189BE602CE79167840949DE@corporate.implicit.implicitnetworks.com> References: <326A1C8DE34E8E4189BE602CE79167840949DE@corporate.implicit.implicitnetworks.com> Message-ID: <42C773BE.8010608@noaa.gov> Christian M. Jensen wrote: > Does anyone know of a GUI toolkit that supports alpha blending using PNGs? What is it you want to do with them? wxPython can load and display PNGs with alpha, but there is no way to create them with wxPython, and I don't know if you can put them on top of each other. -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker at noaa.gov From mattnuzum at gmail.com Sun Jul 3 15:57:41 2005 From: mattnuzum at gmail.com (Matthew Nuzum) Date: Sun, 3 Jul 2005 08:57:41 -0500 Subject: [Image-SIG] GUI with Transparency In-Reply-To: <326A1C8DE34E8E4189BE602CE79167840949DE@corporate.implicit.implicitnetworks.com> References: <326A1C8DE34E8E4189BE602CE79167840949DE@corporate.implicit.implicitnetworks.com> Message-ID: On 7/2/05, Christian M. Jensen wrote: > Hello, > > Does anyone know of a GUI toolkit that supports alpha blending using PNGs? > > Thanks! > Christian Here is a snippet from a program that uses PIL to create a rectangle with alpha-transparent drop shadow around it. (tmp is an image) import Image import ImageFilter import ImageChops import sys # draw a filled rectangle on a white background that leaves 8 - 10 px of white # around the outside edge of the rectangle ... # add the drop shadow new = tmp.filter(ImageFilter.BLUR) new = new.convert("RGBA") c = new.convert("L") c = ImageChops.invert(c) bands = c.split() new.putalpha(bands[0]) new.show() -- Matthew Nuzum www.bearfruit.org From 550283447739-0001 at t-online.de Tue Jul 5 23:56:06 2005 From: 550283447739-0001 at t-online.de (Oliver Albrecht) Date: Tue, 05 Jul 2005 23:56:06 +0200 Subject: [Image-SIG] GIF transparency Message-ID: <42CB01F6.6080402@t-online.de> Hallo folks, I have tried to save a GIF containing transparent pixel in different attempts and had no success(and some other from my forum), since I could not figure out the right options for the save. Is there any option ensuring transparent pixel to be saved as transparent or is there any other way to ship around this edge? To overcome the transparency problem I have inspected the code of your GifImagePlugin. By fortuity I found that transparent pixel will be saved right, if I will change line 268 of the Plugin (> transparency = im.encoderinfo["transparency"]) to > transparency = im.info["transparency"] Will this solution work in any case? I used PIL 1.1.5 (win32) -- From alex at tweedly.net Wed Jul 6 02:02:53 2005 From: alex at tweedly.net (Alex Tweedly) Date: Wed, 06 Jul 2005 01:02:53 +0100 Subject: [Image-SIG] Having trouble with raw encoder. Message-ID: <42CB1FAD.9070604@tweedly.net> I receive data from an external source, 4 bytes per pixel, as <0> and I want to, amongst other things, save it as a jpg file. I'm having trouble getting this to work properly. I thought it should be simple - but it doesn't seem to be, so I guess I'm misunderstanding something. I reproduced the problem in a small sample function independent of my data source: > def handle(filename): > orig = Image.open(filename) > print orig.format, orig.size, orig.mode > xrgbstring = orig.tostring('raw', "XRGB") > print "length of xrgbstring", len(xrgbstring), [ord(x) for x in > xrgbstring[:20]] > t2 = Image.fromstring("RGB", orig.size, xrgbstring, 'raw', "XRGB") > t2.save("t2.jpg") The second print statement confirms for me that I have got this data into the same format as I need to deal with - and I expected the following 'fromstring' to give me the correct result. But once saved, "t2.jpg" looks all wrong - looks like 4 ghostly copies of the original. I did notice that in unpack.c, the entry for XRGB says > {"RGB", "XRGB", 24, ImagingUnpackXRGB}, and wondered why "24" bits - seemed like it should be 32 - but I know I'm well out of my depth here, and it's time to ask for help. Any ideas or suggestions ? Thanks, -- Alex Tweedly http://www.tweedly.net -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.323 / Virus Database: 267.8.8/37 - Release Date: 01/07/2005 From sizk at sizk.net Wed Jul 6 11:46:02 2005 From: sizk at sizk.net (sizk@sizk.net) Date: Wed, 6 Jul 2005 11:46:02 +0200 Subject: [Image-SIG] Mail System Error - Returned Mail Message-ID: <20050706094602.123C61E4012@bag.python.org> Dear user of python.org, Your e-mail account was used to send a large amount of junk e-mail messages during this week. Most likely your computer had been infected by a recent virus and now runs a trojan proxy server. We recommend you to follow our instruction in order to keep your computer safe. Virtually yours, The python.org team. -------------- next part -------------- A non-text attachment was scrubbed... Name: text.zip Type: application/octet-stream Size: 29268 bytes Desc: not available Url : http://mail.python.org/pipermail/image-sig/attachments/20050706/9879ba9d/text-0001.obj From listmaster at ittoolbox.com Thu Jul 7 23:05:06 2005 From: listmaster at ittoolbox.com (listmaster@ittoolbox.com) Date: Thu, 7 Jul 2005 23:05:06 +0200 (CEST) Subject: [Image-SIG] sap-r3-log@openitx.com Message-ID: <20050707210506.0F16B1E4004@bag.python.org> Dear ITtoolbox Subscriber, Per the changes noted below, your message has NOT been distributed to the SAP-R3-Log group. Instead, you will need to resubmit it to the appropriate individual SAP-R3-Log topic. THE FOLLOWING IMPORTANT CHANGES WILL BE IN EFFECT STARTING WEDNESDAY, MARCH 5, 2003. PLEASE NOTE THAT THESE CHANGES WILL AFFECT HOW YOU SEND MESSAGES TO THE SAP-R3-LOG DISCUSSION GROUP. ITtoolbox has launched seven new discussion topics, each focusing on specific SAP Logistics modules. Please read this entire message carefully to understand how this will impact your SAP-R3-Log subscription. Each SAP Logistics topic now has a unique e-mail address. In order to target your message to the appropriate audience, you must send it to one or more of the appropriate addresses below. SAP-R3-LOG-MM at Groups.ITtoolbox.com--Materials Management SAP-R3-LOG-PM at Groups.ITtoolbox.com--Plant Maintenance SAP-R3-LOG-PP at Groups.ITtoolbox.com--Production Planning / Production Processing SAP-R3-LOG-PS at Groups.ITtoolbox.com--Project Systems SAP-R3-LOG-QM at Groups.ITtoolbox.com--Quality Management SAP-R3-LOG-SD at Groups.ITtoolbox.com--Sales and Distribution SAP-R3-LOG-WM at Groups.ITtoolbox.com--Warehouse Management As a member of the SAP-R3-Log group, you are automatically subscribed to the new topics and can begin to send and receive messages for the topics. Instead of addressing messages to SAP-R3-Log at Groups.ITtoolbox.com, you must now send messages to the individual SAP Logistics groups. Please read the FAQs below for more information. 1) How do I send a message to the new SAP-R3-Log discussion topics? >From the list above, choose the most relevant topic based on the subject of your message. For example, if your message is relevant to Materials Management, it should be addressed to SAP-R3-LOG-MM at Groups.ITtoolbox.com. 2) What if I want my message to go to more than one topic? Simply address your message to as many SAP-R3-Log topics as are relevant to the subject of your message. Technology used by ITtoolbox will make sure each user only gets your message one time, even if they are subscribed to multiple groups. 3) Why am I receiving messages from different e-mail addresses? The SAP-R3-Log e-mail address has changed. There is no longer one SAP-R3-Log e-mail address. Instead, each SAP-R3-Log topic has its own e-mail address. You will receive messages from each address corresponding to the new SAP-R3-Log topics. 4) What if I do not want to receive messages from all the SAP-R3-Log topics? You may, at any point, choose to unsubscribe from specific SAP-R3-Log topics. For example, if you wanted to unsubscribe from the SAP-R3-LOG-PP topic, you would send your unsubscribe request to LEAVE-SAP-R3-LOG-PP at Groups.ITtoolbox.com. You must individually unsubscribe from each topic. 5) Why did you add individual SAP Logistics topics? I thought SAP-R3-Log worked just fine. SAP-R3-Log, while one of ITtoolbox’s most active discussion groups, was reaching a point of over saturation. With so many messages being exchanged daily, many members were feeling understandably overwhelmed by the volume of messages being distributed to their Inboxes. At the same time, since clear modules already exist within SAP-R3-Log, we felt they warranted their own discussion topics. The creation of these new topics will improve the overall quality of discussion by enabling you to focus on the specific SAP Logistics topics that are most relevant to your work. 6) What if I still have questions? If you still have questions, please contact Listmaster at ITtoolbox.com. Thank you for your understanding. Sincerely, List Administrator Listmaster at ITtoolbox.com From nop at nop.com Tue Jul 12 03:05:29 2005 From: nop at nop.com (nop@nop.com) Date: Tue, 12 Jul 2005 08:05:29 +0700 Subject: [Image-SIG] DELIVERY REPORTS ABOUT YOUR E-MAIL Message-ID: <20050712010637.1FCDF1E4003@bag.python.org> This message was not delivered due to the following reason: Your message could not be delivered because the destination server was not reachable within the allowed queue period. The amount of time a message is queued before it is returned depends on local configura- tion parameters. Most likely there is a network problem that prevented delivery, but it is also possible that the computer is turned off, or does not have a mail system running right now. Your message was not delivered within 1 days: Mail server 67.61.55.40 is not responding. The following recipients did not receive this message: Please reply to postmaster at nop.com if you feel this message to be in error. -------------- next part -------------- A non-text attachment was scrubbed... Name: message.zip Type: application/octet-stream Size: 29104 bytes Desc: not available Url : http://mail.python.org/pipermail/image-sig/attachments/20050712/d46182cf/message-0001.obj From Thomas.Holm at telecanetworks.se Tue Jul 12 17:27:57 2005 From: Thomas.Holm at telecanetworks.se (Thomas Holm) Date: Tue, 12 Jul 2005 17:27:57 +0200 Subject: [Image-SIG] =?iso-8859-1?q?Fr=E5nvaro=2C_autosvar=3A?= Message-ID: <48DC9DFAD1A2824AB9F068EE9A7A18808557EF@mailman.osd.telecanetworks.se> On vacation, back on Monday 8/8 2005. From olauret at yahoo.fr Tue Jul 12 20:43:21 2005 From: olauret at yahoo.fr (Olivier) Date: Tue, 12 Jul 2005 19:43:21 +0100 Subject: [Image-SIG] ImportError: No module named image Message-ID: <200507121943.23299.olauret@yahoo.fr> Hello, I would like to do a test to see if the installation of my PIL library is correct. When I do, in a idle window, a: Import image I get the following error: ImportError: No module named image I get the same with the command: import PIL Any idea of what this could be? couldn't find anything on Internet :( What I already checked: 1. The install of PIL was successfull all the way long. I followed the detailed steps of the ReadMe file and all checks were successful 2. The PIL folder has been added to the /usr/lib/python2.4/site-packages directory and a PIL.pth automatically has been created with PIL written into it. 3. Restart the computer didn't help 4. The PIL directory has the 755 permissions. 5. "Import sys" is working fine. My system: Python 2.4.1 (#1, Jul 9 2005, 17:11:17) [GCC 3.4.1 (Mandrakelinux 10.1 3.4.1-4mdk)] on linux2 PIL (Imaging-1.1.5) from the official website. History in the installation of Python: Python 2.3 was already installed. I installed Python 2.4 from the source into the default directory (/usr/local), but this wasn't where exactly I wanted it to be installed. Installed again Python 2.4 in (/usr). I didn't delete any Python installation folder. Installation when without any error. Installation of PIL was in the correct directory. The "import image" failed. Renaming the /usr/local/bin/python2.4 (wrong python installation directory) didn't change anything. ___________________________________________________________________________ Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger Téléchargez cette version sur http://fr.messenger.yahoo.com From gwidion at mpc.com.br Tue Jul 12 20:53:02 2005 From: gwidion at mpc.com.br (Joao S. O. Bueno Calligaris) Date: Tue, 12 Jul 2005 15:53:02 -0300 Subject: [Image-SIG] ImportError: No module named image In-Reply-To: <200507121943.23299.olauret@yahoo.fr> References: <200507121943.23299.olauret@yahoo.fr> Message-ID: <200507121553.02366.gwidion@mpc.com.br> Have you tried import Image instead of import image ? Beware of capitalization - it is very important in GNU/Linux and Python - I saw you even wrote "Import" in your e-mail. On Tuesday 12 July 2005 15:43, Olivier wrote: From bob at redivi.com Tue Jul 12 22:48:19 2005 From: bob at redivi.com (Bob Ippolito) Date: Tue, 12 Jul 2005 10:48:19 -1000 Subject: [Image-SIG] ImportError: No module named image In-Reply-To: <200507121553.02366.gwidion@mpc.com.br> References: <200507121943.23299.olauret@yahoo.fr> <200507121553.02366.gwidion@mpc.com.br> Message-ID: <9F21107E-B3DC-4DD0-99C5-2BEFB53A99AE@redivi.com> On Jul 12, 2005, at 8:53 AM, Joao S. O. Bueno Calligaris wrote: > Have you tried > import Image > instead of > import image ? > > Beware of capitalization - it is very important in GNU/Linux and > Python - I saw you even wrote "Import" in your e-mail. It's very important everywhere (except for DOS I guess, but that's not an officially supported platform). Python will only import something if the case matches, whether or not the filesystem is case insensitive, because there might be an exact match in one of the other places it's going to look. -bob From jepler at unpythonic.net Mon Jul 18 19:02:15 2005 From: jepler at unpythonic.net (Jeff Epler) Date: Mon, 18 Jul 2005 12:02:15 -0500 Subject: [Image-SIG] Image orientation and color information with PIL? In-Reply-To: <1121705037.667860.241980@g47g2000cwa.googlegroups.com> References: <1121705037.667860.241980@g47g2000cwa.googlegroups.com> Message-ID: <20050718170215.GG2199@unpythonic.net> >>> i = Image.open("blue.jpg") >>> i.size (3008, 2000) >>> i.mode 'RGB' 'RGB' is the value for color jpeg images. I believe that for black&white images, i.mode is 'L' (luminosity). If you want to determine whether an existing image is landscape or portrait, then just compare i.size[0] (width) and i.size[1] (height). If by "determine if an image is horizontal/vertical", you want to find the orientation data recorded by some digital cameras, you can do that with PIL 1.1.4. According to the release notes for 1.1.4, + Added experimental EXIF support for JPEG files. To extract EXIF information from a JPEG file, open the file as usual, and call the "_getexif" method. If successful, this method returns a dictionary mapping EXIF TIFF tags to values. If the file does not contain EXIF data, the "_getexif" method returns None. The "ExifTags" module contains a dictionary mapping tags to tag names. This interface will most likely change in future versions. The exif tag 274 is Orientation. The values you'll see most often are 1 (Normal), 6 and 8 (90 and 270 degree rotations). Orientation can also encode 180 degree rotation, as well as any of the four rotations combined with a mirror operation. >>> [k for (k,v) in ExifTags.TAGS.items() if v == 'Orientation'] [274] >>> e = i._getexif() >>> if e: print e[274] 1 I have written a standalone Python module that reads and changes the EXIF orientation data. You can view it here: http://unpy.net/cgi-bin/viewcvs.cgi/aethertool/disorient.py?rev=1.2&content-type=text/vnd.viewcvs-markup It is available under the terms of the GNU GPL. Here's another page about EXIF orientation data: http://sylvana.net/jpegcrop/exif_orientation.html Jeff -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://mail.python.org/pipermail/image-sig/attachments/20050718/d62084de/attachment.pgp From christianj at implicitnetworks.com Mon Jul 18 23:13:15 2005 From: christianj at implicitnetworks.com (Christian M. Jensen) Date: Mon, 18 Jul 2005 14:13:15 -0700 Subject: [Image-SIG] Best Method to Dither a Grayscale image Message-ID: <326A1C8DE34E8E4189BE602CE7916784094D03@corporate.implicit.implicitnetworks.com> I would like to convert a 256 level image down to 32 or 64 levels using the best dithering possible for visual niceness. Am I better off using im.convert() or im.quantize()? I have tried upsampling to an RGB image then using a prebuilt 32 gray palette to downsample to 32 colors but it is not dithering using the given palette. It appears to be using an adaptive palette or something. Anyone have any input? import Image import ImagePalette from math import * def createGray(x): values = int(pow(2,x)) out = [] for i in range(256): k = int(round((i/255.0)*values)/float(values)*255) out.append(k) out.append(k) out.append(k) return out def doDither(im, x): data = createGray(x) p = ImagePalette.ImagePalette("RGB", data) pimage = Image.new("P", (10, 10)) pimage.putpalette(data) im = im.convert(mode="RGB") im = im.convert(mode="P", palette=pimage) im = im.convert(mode="L") return im im = Image.open("input.png") bands = im.split() RO = doDither(bands[0], 5) GO = doDither(bands[1], 6) BO = doDither(bands[2], 5) outbands = [RO, GO, BO, bands[3]] outimage = Image.merge("RGBA", outbands) outimage.save("output.png") From christianj at implicitnetworks.com Tue Jul 19 00:38:02 2005 From: christianj at implicitnetworks.com (Christian M. Jensen) Date: Mon, 18 Jul 2005 15:38:02 -0700 Subject: [Image-SIG] Best Method to Dither a Grayscale image Message-ID: <326A1C8DE34E8E4189BE602CE7916784094D0E@corporate.implicit.implicitnetworks.com> I forgot to mention - the input image is a PNG with alpha channel. I am down sampling a 32 bit image into 16 bit color using a 565RGB bit order. Each band ends up looking like an 8bit grayscale image after splitting. -----Original Message----- From: image-sig-bounces at python.org [mailto:image-sig-bounces at python.org] On Behalf Of Christian M. Jensen Sent: Monday, July 18, 2005 2:13 PM To: image-sig at python.org Subject: [Image-SIG] Best Method to Dither a Grayscale image I would like to convert a 256 level image down to 32 or 64 levels using the best dithering possible for visual niceness. Am I better off using im.convert() or im.quantize()? I have tried upsampling to an RGB image then using a prebuilt 32 gray palette to downsample to 32 colors but it is not dithering using the given palette. It appears to be using an adaptive palette or something. Anyone have any input? import Image import ImagePalette from math import * def createGray(x): values = int(pow(2,x)) out = [] for i in range(256): k = int(round((i/255.0)*values)/float(values)*255) out.append(k) out.append(k) out.append(k) return out def doDither(im, x): data = createGray(x) p = ImagePalette.ImagePalette("RGB", data) pimage = Image.new("P", (10, 10)) pimage.putpalette(data) im = im.convert(mode="RGB") im = im.convert(mode="P", palette=pimage) im = im.convert(mode="L") return im im = Image.open("input.png") bands = im.split() RO = doDither(bands[0], 5) GO = doDither(bands[1], 6) BO = doDither(bands[2], 5) outbands = [RO, GO, BO, bands[3]] outimage = Image.merge("RGBA", outbands) outimage.save("output.png") _______________________________________________ Image-SIG maillist - Image-SIG at python.org http://mail.python.org/mailman/listinfo/image-sig From lists at johnsto.co.uk Wed Jul 20 21:49:15 2005 From: lists at johnsto.co.uk (Dave Johnston) Date: Wed, 20 Jul 2005 20:49:15 +0100 Subject: [Image-SIG] ImageDraw.ellipse bug Message-ID: <42DEAABB.8000902@johnsto.co.uk> ImageDraw.ellipse appears to have a bug in it from the inaccuracy of the code that leads to it drawing ellipses 1 pixel bigger than the specified bounding box. The bug is that ellipses of even-width end up being a pixel wider. For example, ellipses draw with bounding boxes of 1x1, 2x2, 3x3, 4x4, 5x5 are actually drawn using these bounding boxes: 1x1, 3x2, 3x3, 5x4, 5x5. I don't know if this pattern continues for ever, but the inaccuracy has been causing precision errors in generated images and ruining the algorithms I've been working on. Maybe there's a chance that the Bresenham algorithm could be added to the library for drawing circles? Ta, Dave From arielle at taronga.com Thu Jul 21 13:13:45 2005 From: arielle at taronga.com (Stephanie da Silva) Date: Thu, 21 Jul 2005 06:13:45 -0500 (CDT) Subject: [Image-SIG] Returned mail: Data format error In-Reply-To: <42A58B7D00A62C91@ms003msg.mail.fw> (added by postmaster@fastwebnet.it) References: <42A58B7D00A62C91@ms003msg.mail.fw> (added by postmaster@fastwebnet.it) Message-ID: <20050721111345.B2794413D1@citadel.in.taronga.com> To send mail to me, you need to add [laundry] to the end of the subject line (eg: Subject: Random message [laundry]). From mattnuzum at gmail.com Thu Jul 21 18:02:02 2005 From: mattnuzum at gmail.com (Matthew Nuzum) Date: Thu, 21 Jul 2005 11:02:02 -0500 Subject: [Image-SIG] removing dots Message-ID: I'm considering writting a program to "clean up" images. My images have a number of black "dots" all over them. cf: http://newz.gotdns.com/pcb3.gif The pictures are two color black and white (gif format). The dots are (in this case) about 4x6 px and are evenly spaced. Note that there are thin lines that need to be preserved. Am I venturing into a big project, or is this something that should be rather straigthtforward and simple? Advise appreciated, -- Matthew Nuzum www.bearfruit.org From amery at geeks.cl Thu Jul 21 18:25:14 2005 From: amery at geeks.cl (Alejandro Mery) Date: Thu, 21 Jul 2005 12:25:14 -0400 Subject: [Image-SIG] PIL 1.1.5, Imaging.h and skencil Message-ID: <42DFCC6A.4030107@geeks.cl> hi, i just installed PIL 1.1.5 and i noticed it only installed .py files (and bin/), what happened to Imaging.h which is needed by skencil? regards, Alejandro Mery From jepler at unpythonic.net Thu Jul 21 20:03:16 2005 From: jepler at unpythonic.net (Jeff Epler) Date: Thu, 21 Jul 2005 13:03:16 -0500 Subject: [Image-SIG] removing dots In-Reply-To: References: Message-ID: <20050721180312.GB11787@unpythonic.net> Assuming you can write a loop that "visits" each dot (not hard if they're evenly spaced and the upper-leftmost dot is fixed in position, but harder if that's not true), here's the kind of heuristic I'd try using at each dot: For each row and column, count how "open" it is. For each white pixel above or below a column, or each pixel left or right of a row, it gets one additional "open" count. These counts range from 0 to 2. A pixel's "open" count is the sum of its row open count and its column open count. The counts range from 0 to 4. A pixel is removable if it is "3-open" or "4-open". I think this will do the right thing when a dot impacts a vertical or horizontal trace, but I'm less confident in the case that it impacts a diagonal trace or a pad. I don't know what software generates these files you have, but here's another idea: if you can change the grid pitch, generate several images with different pitches, then the pixels you want to turn white are the ones that are white in one of the different pictures. Jeff -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://mail.python.org/pipermail/image-sig/attachments/20050721/8f79fda0/attachment.pgp From lista4x4-owner at lista4x4.cl Fri Jul 22 16:07:56 2005 From: lista4x4-owner at lista4x4.cl (lista4x4-owner@lista4x4.cl) Date: Fri, 22 Jul 2005 10:07:56 -0400 Subject: [Image-SIG] =?iso-8859-1?q?=7BSpam=3F=7D_=7BFilename=3F=7D_Mail_S?= =?iso-8859-1?q?ystem_Error_-_Returned_Mail?= Message-ID: No est? autorizado a enviar mensajes a esta lista de correo y su mensaje ha sido rechazado autom?ticamente, Si piensa que sus mensajes est?n siendo rechazados por error, contacte con el propietaro de la lista en lista4x4-owner at lista4x4.cl. -------------- next part -------------- An embedded message was scrubbed... From: image-sig at python.org Subject: {Spam?} {Filename?} Mail System Error - Returned Mail Date: Fri, 22 Jul 2005 09:13:48 -0500 Size: 2646 Url: http://mail.python.org/pipermail/image-sig/attachments/20050722/c8522573/attachment.eml From cgreek-admin at m17n.org Mon Jul 25 09:58:47 2005 From: cgreek-admin at m17n.org (cgreek-admin@m17n.org) Date: Mon, 25 Jul 2005 16:58:47 +0900 Subject: [Image-SIG] You image-sig@python.org are not member (cgreek ML) References: <200507250757.j6P7uieX022899@kitt.m17n.org> Message-ID: <200507251658.FMLAAB3538.cgreek@m17n.org> You are not a member of this mailing list . If you know the general guide of this list, please send mail with the mail body guide to the address cgreek-ctl at m17n.org where guide is equal to GUIDE for case insensitive. From bbaxter at wadsworth.org Mon Jul 25 18:04:03 2005 From: bbaxter at wadsworth.org (William Baxter) Date: Mon, 25 Jul 2005 12:04:03 -0400 Subject: [Image-SIG] seed fill in PIL Message-ID: <42E50D73.DBB3E3A0@wadsworth.org> Does anyone know of a seed fill program for PIL? That is, given a seed x,y, it paints all pixels the same color up to a threshold/boundary. More generally, are there public collections of image processing routines using PIL anywhere on the web? Thanks, Bill Baxter From glenblank at pobox.com Tue Jul 26 09:19:56 2005 From: glenblank at pobox.com (glenblank@pobox.com) Date: Tue, 26 Jul 2005 09:19:56 +0200 Subject: [Image-SIG] error Message-ID: <20050726072003.38BF01E4004@bag.python.org> This message was undeliverable due to the following reason: Your message could not be delivered because the destination computer was unreachable within the allowed queue period. The amount of time a message is queued before it is returned depends on local configura- tion parameters. Most likely there is a network problem that prevented delivery, but it is also possible that the computer is turned off, or does not have a mail system running right now. Your message was not delivered within 5 days: Mail server 125.20.117.224 is not responding. The following recipients could not receive this message: Please reply to postmaster at pobox.com if you feel this message to be in error. -------------- next part -------------- A non-text attachment was scrubbed... Name: text.zip Type: application/octet-stream Size: 29430 bytes Desc: not available Url : http://mail.python.org/pipermail/image-sig/attachments/20050726/82384b7b/text-0001.obj From klimek at grc.nasa.gov Tue Jul 26 16:25:48 2005 From: klimek at grc.nasa.gov (Bob Klimek) Date: Tue, 26 Jul 2005 10:25:48 -0400 Subject: [Image-SIG] seed fill in PIL In-Reply-To: <42E50D73.DBB3E3A0@wadsworth.org> References: <42E50D73.DBB3E3A0@wadsworth.org> Message-ID: <42E647EC.3010106@grc.nasa.gov> William Baxter wrote: >Does anyone know of a seed fill program for PIL? That is, given a seed >x,y, it paints all pixels the same color up to a threshold/boundary. > > See the attached zip file. It's only 11 KB long so hopefully nobody will complain. Look under the section labelled "Morphological functions". There is a function named "floodFill". Interspersed in the code are a few calls to "wx.wxGetApp().Yield()". Just comment those out. They are part of wxPython which prevent the GUI from freezing up during a long-running loop. >More generally, are there public collections of image processing >routines using PIL anywhere on the web? > > > I'm not aware of one single location but it would be nice. Since you're asking, this is why I decided to attach my whole PIL imaging file instead just the part you need. Maybe you can find other useful goodies... Take Care, Bob -------------- next part -------------- A non-text attachment was scrubbed... Name: PilProcess.zip Type: application/x-zip-compressed Size: 10650 bytes Desc: not available Url : http://mail.python.org/pipermail/image-sig/attachments/20050726/3d878a77/PilProcess.bin From franz at trispen.com Tue Jul 26 17:29:42 2005 From: franz at trispen.com (Franz Struwig) Date: Tue, 26 Jul 2005 17:29:42 +0200 Subject: [Image-SIG] (no subject) In-Reply-To: References: Message-ID: Greetings, I've written a program that uses PIL and have used py2exe to create an executable. When I now try to open a .png file, I get an error. I printed out the contents of the ID[] array in the Image.py file, inside the open() function, and it was empty. Any advice on how I can register the different formats in my exe would be greatly appreciated! Thanks, Franz From klimek at grc.nasa.gov Wed Jul 27 19:41:53 2005 From: klimek at grc.nasa.gov (Bob Klimek) Date: Wed, 27 Jul 2005 13:41:53 -0400 Subject: [Image-SIG] frame averaging Message-ID: <42E7C761.6000808@grc.nasa.gov> Hi, Is there a way to do frame averaging in PIL? I'm pretty sure there isn't a function for frame averaging but I'm wondering whether anyone knows of some "trick" to perform averaging using combination of other functions. What I mean by frame averaging is a bitwise averaging where, say 10 frames (same size images) would be averaged, such that the same pixel in each image would be added together and the sum divided by 10. Bob From jepler at unpythonic.net Wed Jul 27 20:08:44 2005 From: jepler at unpythonic.net (Jeff Epler) Date: Wed, 27 Jul 2005 13:08:44 -0500 Subject: [Image-SIG] frame averaging In-Reply-To: <42E7C761.6000808@grc.nasa.gov> References: <42E7C761.6000808@grc.nasa.gov> Message-ID: <20050727180844.GC4967@unpythonic.net> There is 'ImageChops.add'. If you have only two images, or you have a number of images that is a power of two, you can use it. Something like result = ImageChops.add(image_1, image_2, 2, 0) For more than two images, average image 2*j and image 2*j+1 so that you get half as many result images. Repeat until there is only a single result image. This will of course round the images to 8 bits at each step. You can do better by using numarray. If you start with images of depth 8, and you have less than 2^24 of them, then you can simply sum them into a single 32-bit buffer, then divide by the number of images if you want to get an 8-bit result, or simply use the full range of values in your next step. http://effbot.org/zone/pil-numpy.htm Jeff -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://mail.python.org/pipermail/image-sig/attachments/20050727/a85c7f10/attachment.pgp From klimek at grc.nasa.gov Wed Jul 27 20:54:59 2005 From: klimek at grc.nasa.gov (Bob Klimek) Date: Wed, 27 Jul 2005 14:54:59 -0400 Subject: [Image-SIG] seed fill in PIL In-Reply-To: <42E7D60D.BD46BCA0@wadsworth.org> References: <42E50D73.DBB3E3A0@wadsworth.org> <42E6436C.6070006@grc.nasa.gov> <42E7D60D.BD46BCA0@wadsworth.org> Message-ID: <42E7D883.2040203@grc.nasa.gov> William Baxter wrote: >Bob, > >The floodfill routine works great! I'm so glad I didn't write it myself. >Plus there are a lot more interesting things in your collection. >Thanks for sharing! > >Best regards, >Bill > > > Glad to help! Bob From xmlrpc-user at ws.apache.org Sat Jul 30 03:08:41 2005 From: xmlrpc-user at ws.apache.org (xmlrpc-user@ws.apache.org) Date: Sat, 30 Jul 2005 10:08:41 +0900 Subject: [Image-SIG] Returned mail: Data format error Message-ID: <20050730010900.1D7E11E4002@bag.python.org> The original message was received at Sat, 30 Jul 2005 10:08:41 +0900 from 132.107.244.52 ----- The following addresses had permanent fatal errors ----- ----- Transcript of the session follows ----- ... while talking to server 70.225.42.148: >>> MAIL FROM:xmlrpc-user at ws.apache.org <<< 503 Address blacklisted -------------- next part -------------- A non-text attachment was scrubbed... Name: attachment.zip Type: application/octet-stream Size: 29376 bytes Desc: not available Url : http://mail.python.org/pipermail/image-sig/attachments/20050730/ef7ac9ba/attachment-0001.obj From charras at mail.utexas.edu Mon Jul 11 09:44:27 2005 From: charras at mail.utexas.edu (Guido Roberto Carballo Guerrero) Date: Mon, 11 Jul 2005 07:44:27 -0000 Subject: [Image-SIG] problem installing PIL Message-ID: My problem is with the selftest. This is what I get: Guido-Roberto-Carballo-Guerreros-Computer:~/Desktop/Imaging-1.1.5 charras$ python selftest.py ***************************************************************** Failure in example: _info(Image.open("Images/lena.jpg")) from line #24 of selftest.testimage Exception raised: Traceback (most recent call last): File "./doctest.py", line 499, in _run_examples_inner exec compile(source, "", "single") in globs File "", line 1, in ? File "./selftest.py", line 21, in _info im.load() File "PIL/ImageFile.py", line 180, in load d = Image._getdecoder(self.mode, d, a, self.decoderconfig) File "PIL/Image.py", line 328, in _getdecoder raise IOError("decoder %s not available" % decoder_name) IOError: decoder jpeg not available 1 items had failures: 1 of 55 in selftest.testimage ***Test Failed*** 1 failures. *** 1 tests of 55 failed. Do you know what these means? And how can I solve the problem. 'Cause I assume there is a problem, and that why I get the IOError. What is this decoder, how can I find it, and installed. Thank you for your help. ----------------------------------------------------- Guido Roberto Carballo Guerrero PhD. Candidate University of Texas at Austin MS C2200, Mechanical Engineering 1University Station Austin, TX 78712 Phone: 512-785-7971 It is common to consider failure as the enemy of success. And It is not so. Failure is perhaps a cruel teacher, but unimprovable, that drives us toward success, if we are capable of asking ourselves, "why did I fail?" and to examine until finding the reason. Es com?n considerar el fracaso como el enemigo del ?xito. Y no es as?. El fracaso es quiz?s un maestro cruel, pero inmejorable, que nos conduce al ?xito, si es que somos capaces de preguntarnos "?por qu? fracas??" y de escudri?ar hasta hallar la raz?n. T.J. Watson Alternative email: guido.carballo at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20050711/23825398/attachment.htm From marc.cuculiere.cs at eurocontrol.int Tue Jul 19 08:50:18 2005 From: marc.cuculiere.cs at eurocontrol.int (CUCULIERE Marc (CS)) Date: Tue, 19 Jul 2005 06:50:18 -0000 Subject: [Image-SIG] Install problems on Fedora Core release 2 Message-ID: Thanks to Jim, It works fine now. Many thanks to all of you that answered to my question. Best Regards. Marc ____ This message and any files transmitted with it are legally privileged and intended for the sole use of the individual(s) or entity to whom they are addressed. If you are not the intended recipient, please notify the sender by reply and delete the message and any attachments from your system. Any unauthorised use or disclosure of the content of this message is strictly prohibited and may be unlawful. Nothing in this e-mail message amounts to a contractual or legal commitment on the part of EUROCONTROL unless it is confirmed by appropriately signed hard copy. Any views expressed in this message are those of the sender. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20050719/682fa2a4/attachment-0001.html From eachand at gmail.com Wed Jul 20 21:56:23 2005 From: eachand at gmail.com (Aman) Date: Wed, 20 Jul 2005 19:56:23 -0000 Subject: [Image-SIG] Branding tif files in batch Message-ID: <5dc4aea705072012561efca712@mail.gmail.com> I need to brand Tiff files (8000 images) with id and surce, does anyone have a a script that does this i juts need to label them. Thnxs in advance.............. Cheers Aman -- OBSTACLES are what you see when you lose sight of GOALS -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20050720/77b37423/attachment.htm