From d_berthelot at yahoo.com Sun Feb 1 08:46:05 2009 From: d_berthelot at yahoo.com (David Berthelot) Date: Sat, 31 Jan 2009 23:46:05 -0800 (PST) Subject: [Image-SIG] New member and question about colorspace query in PythonMagick Message-ID: <637287.3266.qm@web52109.mail.re2.yahoo.com> Hi, I've been using PIL for a while, and I mostly use it as front-end to numpy, doing some image processing using all the elaborate math tools available in numpy. However I found out that PIL sometimes doesn't produce the correct output for some JPEG files (for examples 4 channel JPEG), however these can be read by ImageMagick, so that's how I turned to PythonMagick. So here come the difficulties, I couldn't find a documentation for it. So I naturally looked at the Magick++ documentation (which is what PythonMagick is wrapping anyway). What I want to do is overly simple: query the colorspace (RGB,RGBA,CMYK,YCbCr, or whatever it is) of an image. >>> import PythonMagick as PM >>> img = PM.Image("test.jpg") >>> img.colorSpace > >>> img.colorSpace() TypeError: No to_python (by-value) converter found for C++ type: MagickLib::ColorspaceType At this point, I'm not sure how to check the colorspace, did I just hit a non-implemented part of the API ? I'm using PythonMagick 0.8 (on Ubuntu 8.04). Thanks, David Berthelot From fbuchinger at gmail.com Sun Feb 1 17:05:59 2009 From: fbuchinger at gmail.com (Franz Buchinger) Date: Sun, 1 Feb 2009 17:05:59 +0100 Subject: [Image-SIG] Determine byte offset of JPEG SOI marker In-Reply-To: References: Message-ID: Hi, I want to implement some sort of "post header checksum" for JPEG images, i.e. the checksum should only change if the actual image data was altered, EXIF/IPTC metadata modifications should have no effect. My plan to do this is to scan for the JPEG SOI marker, read n bytes after this marker and calcultate an MD5/SHA checksum for this. Can PIL tell me the byte offset of this marker? Greetings, Franz From fbuchinger at gmail.com Sun Feb 1 18:41:43 2009 From: fbuchinger at gmail.com (Franz Buchinger) Date: Sun, 1 Feb 2009 18:41:43 +0100 Subject: [Image-SIG] Determine byte offset of JPEG SOI marker In-Reply-To: <4985CF46.8020207@nedbatchelder.com> References: <4985CF46.8020207@nedbatchelder.com> Message-ID: I think I made a conceptual mistake: I should look for SOS (ffda, start of stream), not SOI (start of image). Unfortunately, figuring out this marker is not so easy, because many JPEG files from digital still cameras have a thumbnail embedded in one of their header segments. As this thumbnail image is a JPEG file itself, simply searching for SOS will lead to wrong results. I observed that PIL just reads until SOS when I open a JPEG image. I think the easiest way of retrieving the SOS marker offset would be accessing PILs internal data structures. Any hints on that? Greetings, Franz 2009/2/1 Ned Batchelder : > In the files I'm looking at, the SOI marker (ffd8) is at offset 0. But > assuming you have some where it is not, why not just open the file, and look > for the marker?: > > head = open(jpg_filename, "rb").read(4000) > soi_offset = head.find('\xff\xd8') > > You're going to have to open and read the file to compute the checksum > anyway... > > --Ned. > http://nedbatchelder.com > > Franz Buchinger wrote: > > Hi, > > I want to implement some sort of "post header checksum" for JPEG > images, i.e. the checksum should only change if the actual image data > was altered, EXIF/IPTC metadata modifications should have no effect. > My plan to do this is to scan for the JPEG SOI marker, read n bytes > after this marker and calcultate an MD5/SHA checksum for this. > > Can PIL tell me the byte offset of this marker? > > Greetings, > > Franz > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > > > > > > -- > Ned Batchelder, http://nedbatchelder.com > From ned at nedbatchelder.com Sun Feb 1 17:35:18 2009 From: ned at nedbatchelder.com (Ned Batchelder) Date: Sun, 01 Feb 2009 11:35:18 -0500 Subject: [Image-SIG] Determine byte offset of JPEG SOI marker In-Reply-To: References: Message-ID: <4985CF46.8020207@nedbatchelder.com> In the files I'm looking at, the SOI marker (ffd8) is at offset 0. But assuming you have some where it is not, why not just open the file, and look for the marker?: head = open(jpg_filename, "rb").read(4000) soi_offset = head.find('\xff\xd8') You're going to have to open and read the file to compute the checksum anyway... --Ned. http://nedbatchelder.com Franz Buchinger wrote: > Hi, > > I want to implement some sort of "post header checksum" for JPEG > images, i.e. the checksum should only change if the actual image data > was altered, EXIF/IPTC metadata modifications should have no effect. > My plan to do this is to scan for the JPEG SOI marker, read n bytes > after this marker and calcultate an MD5/SHA checksum for this. > > Can PIL tell me the byte offset of this marker? > > Greetings, > > Franz > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > > > > -- Ned Batchelder, http://nedbatchelder.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From novalis at novalis.org Mon Feb 2 01:41:18 2009 From: novalis at novalis.org (David Turner) Date: Sun, 01 Feb 2009 19:41:18 -0500 Subject: [Image-SIG] YUYV support for PIL Message-ID: <1233535278.20254.35.camel@cory> I have written YUYV support for PIL. YUYV is a format widely used by crappy webcams. It's 32 bits for 2 pixels. The pixels have their own Y values, but share U and V values. A patch is attached. I think it might be possible to add this in pure Python, but I could not figure out how from the documentation. Could someone help, so that I could use PIL before the next release? I tested it with my crappy webcam (04f2:b018 Chicony Electronics Co., Ltd), and it worked. -------------- next part -------------- A non-text attachment was scrubbed... Name: Imaging-yuyv.patch Type: text/x-patch Size: 2456 bytes Desc: not available URL: From post at yanone.de Tue Feb 3 18:24:55 2009 From: post at yanone.de (Yanone) Date: Tue, 3 Feb 2009 18:24:55 +0100 Subject: [Image-SIG] can't compile aggdraw on ubuntu Message-ID: hi everybody, i can't get the aggdraw module (1.2a3-20060212) to compile on a standard i386 ubuntu box. gcc (version 4.2.4) and build-essential are installed. here's the output. sorry that some is in german, but you'll get it. i have no idea where to look. google didn't say anything either. thanks a lot... jan python setup.py install === freetype not available (edit setup.py to enable) running install running build running build_ext building 'aggdraw' extension creating build creating build/temp.linux-i686-2.5 creating build/temp.linux-i686-2.5/agg2 creating build/temp.linux-i686-2.5/agg2/src gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall - Wstrict-prototypes -fPIC -Iagg2/include -I/usr/include/python2.5 -c aggdraw.cxx -o build/temp.linux-i686-2.5/aggdraw.o cc1plus: Warnung: Kommandozeilenoption "-Wstrict-prototypes" ist g?ltig f?r Ada/C/ObjC, aber nicht f?r C++ aggdraw.cxx:47:20: Fehler: Python.h: No such file or directory aggdraw.cxx:98: Fehler: ?PyObject_HEAD? bezeichnet keinen Typ aggdraw.cxx:106: Fehler: ISO-C++ verbietet Deklaration von ?PyObject? ohne Typ aggdraw.cxx:106: Fehler: expected ?;? before ?*? token aggdraw.cxx:107: Fehler: ISO-C++ verbietet Deklaration von ?PyObject? ohne Typ aggdraw.cxx:107: Fehler: expected ?;? before ?*? token aggdraw.cxx:117: Fehler: expected initializer before ?*? token aggdraw.cxx:120: Fehler: expected initializer before ?*? token aggdraw.cxx:122: Fehler: ?PyTypeObject? bezeichnet keinen Typ aggdraw.cxx:133: Fehler: ?PyObject_HEAD? bezeichnet keinen Typ aggdraw.cxx:140: Fehler: ?PyTypeObject? bezeichnet keinen Typ aggdraw.cxx:153: Fehler: ?PyObject_HEAD? bezeichnet keinen Typ aggdraw.cxx:159: Fehler: ?PyTypeObject? bezeichnet keinen Typ aggdraw.cxx:172: Fehler: ISO-C++ verbietet Deklaration von ?PyObject_HEAD? ohne Typ aggdraw.cxx:173: Fehler: expected ?;? before ?char? aggdraw.cxx:183: Fehler: expected initializer before ?*? token aggdraw.cxx:185: Fehler: ?PyTypeObject? bezeichnet keinen Typ aggdraw.cxx:198: Fehler: ?PyObject_HEAD? bezeichnet keinen Typ aggdraw.cxx:203: Fehler: expected initializer before ?*? token aggdraw.cxx:205: Fehler: ?PyTypeObject? bezeichnet keinen Typ aggdraw.cxx:217: Fehler: ?PyObject? wurde in diesem G?ltigkeitsbereich nicht definiert aggdraw.cxx:217: Fehler: ?color? wurde in diesem G?ltigkeitsbereich nicht definiert aggdraw.cxx:217: Fehler: expected primary-expression before ?int? aggdraw.cxx:256: Fehler: ?PyObject? wurde nicht deklariert aggdraw.cxx:257: Fehler: ?PyObject? wurde nicht deklariert aggdraw.cxx:258: Fehler: ?PyObject? wurde nicht deklariert aggdraw.cxx:290: Fehler: ?PyObject? wurde nicht deklariert aggdraw.cxx:290: Fehler: ?PyObject? wurde nicht deklariert aggdraw.cxx: In member function ?void draw_adaptor::draw (agg::path_storage&, int*, int*)?: aggdraw.cxx:299: Fehler: Abfrage des Elementes ?ob_type? in ?obj1->?, das vom Nicht-Klassentyp ?int? ist aggdraw.cxx:299: Fehler: ?PenType? wurde in diesem G?ltigkeitsbereich nicht definiert aggdraw.cxx:301: Fehler: Abfrage des Elementes ?ob_type? in ?obj2->?, das vom Nicht-Klassentyp ?int? ist aggdraw.cxx:307: Fehler: Abfrage des Elementes ?ob_type? in ?obj2->?, das vom Nicht-Klassentyp ?int? ist aggdraw.cxx:307: Fehler: ?BrushType? wurde in diesem G?ltigkeitsbereich nicht definiert aggdraw.cxx:309: Fehler: Abfrage des Elementes ?ob_type? in ?obj1->?, das vom Nicht-Klassentyp ?int? ist aggdraw.cxx:332: Fehler: ?struct BrushObject? hat kein Element namens ?color? aggdraw.cxx:343: Fehler: ?struct PenObject? hat kein Element namens ?color? aggdraw.cxx: At global scope: aggdraw.cxx:407: Fehler: ?PyObject? wurde nicht deklariert aggdraw.cxx: In function ?void clear(DrawObject*, int*)?: aggdraw.cxx:409: Fehler: ?Py_None? wurde in diesem G?ltigkeitsbereich nicht definiert aggdraw.cxx:410: Fehler: keine ?bereinstimmung f?r Aufruf von ?(agg::rgba8) (int*&)? aggdraw.cxx: In function ?void draw_setup(DrawObject*)?: aggdraw.cxx:457: Fehler: ?struct DrawObject? hat kein Element namens ?draw? aggdraw.cxx:457: Warnung: veraltete Konvertierung von Zeichenkettenkonstante in ?char*? aggdraw.cxx:460: Fehler: ?struct DrawObject? hat kein Element namens ?draw? aggdraw.cxx:460: Warnung: veraltete Konvertierung von Zeichenkettenkonstante in ?char*? aggdraw.cxx:463: Fehler: ?struct DrawObject? hat kein Element namens ?draw? aggdraw.cxx:463: Warnung: veraltete Konvertierung von Zeichenkettenkonstante in ?char*? aggdraw.cxx:466: Fehler: ?struct DrawObject? hat kein Element namens ?draw? aggdraw.cxx:466: Warnung: veraltete Konvertierung von Zeichenkettenkonstante in ?char*? aggdraw.cxx: At global scope: aggdraw.cxx:471: Fehler: expected initializer before ?*? token aggdraw.cxx:119: Warnung: ?void draw_dealloc(DrawObject*)? als ?static? deklariert, aber nirgendwo definiert aggdraw.cxx:138: Warnung: ?void pen_dealloc(PenObject*)? als ?static? deklariert, aber nirgendwo definiert aggdraw.cxx:157: Warnung: ?void brush_dealloc(BrushObject*)? als ?static? deklariert, aber nirgendwo definiert aggdraw.cxx:182: Warnung: ?void font_dealloc(FontObject*)? als ?static? deklariert, aber nirgendwo definiert aggdraw.cxx:202: Warnung: ?void path_dealloc(PathObject*)? als ?static? deklariert, aber nirgendwo definiert aggdraw.cxx:407: Warnung: ?void clear(DrawObject*, int*)? definiert, aber nicht verwendet aggdraw.cxx:453: Warnung: ?void draw_setup(DrawObject*)? definiert, aber nicht verwendet error: command 'gcc' failed with exit status 1 From tim at timhatch.com Tue Feb 3 20:05:51 2009 From: tim at timhatch.com (Tim Hatch) Date: Tue, 3 Feb 2009 11:05:51 -0800 Subject: [Image-SIG] can't compile aggdraw on ubuntu In-Reply-To: References: Message-ID: > i can't get the aggdraw module (1.2a3-20060212) to compile on a > standard i386 ubuntu box. gcc (version 4.2.4) and build-essential > are installed. here's the output. sorry that some is in german, but > you'll get it. > i have no idea where to look. google didn't say anything either. > aggdraw.cxx:47:20: Fehler: Python.h: No such file or directory > aggdraw.cxx:98: Fehler: ?PyObject_HEAD? bezeichnet keinen Typ ... You're missing python-dev or so. Tim From mail at karsten.name Tue Feb 3 19:45:39 2009 From: mail at karsten.name (Karsten Hiddemann) Date: Tue, 03 Feb 2009 19:45:39 +0100 Subject: [Image-SIG] can't compile aggdraw on ubuntu In-Reply-To: References: Message-ID: <498890D3.2080000@karsten.name> Yanone schrieb: > aggdraw.cxx:47:20: Fehler: Python.h: No such file or directory I'd start there. Cheers, Karsten From karsten.hiddemann at mathematik.uni-dortmund.de Tue Feb 3 19:48:14 2009 From: karsten.hiddemann at mathematik.uni-dortmund.de (Karsten Hiddemann) Date: Tue, 03 Feb 2009 19:48:14 +0100 Subject: [Image-SIG] can't compile aggdraw on ubuntu In-Reply-To: References: Message-ID: <4988916E.90500@mathematik.uni-dortmund.de> Yanone schrieb: > aggdraw.cxx:47:20: Fehler: Python.h: No such file or directory I'd start there. Cheers, Karsten From post at yanone.de Tue Feb 3 20:35:39 2009 From: post at yanone.de (Yanone) Date: Tue, 3 Feb 2009 20:35:39 +0100 Subject: [Image-SIG] can't compile aggdraw on ubuntu In-Reply-To: References: Message-ID: <2BC731F5-2082-4794-B26B-B17F6F451F9D@yanone.de> > > You're missing python-dev or so. > > Tim that's exactly the solution. thank you. From evg.salmin at gmail.com Wed Feb 4 11:49:38 2009 From: evg.salmin at gmail.com (Evgeny Salmin) Date: Wed, 4 Feb 2009 16:49:38 +0600 Subject: [Image-SIG] Converting images to palette mode Message-ID: Hello. Seems I found something interesting, please consider att1 code from libImaging of PIL. I think there is will be a memory leak if we goto "done" label from while. Heap will not be freed. I wrote C example which uses ImageNew and ImageQuantize methods. While debugging it under windows with CRT debug malloc/free it shows that this code has two leaks. One is 1024 kb and second is 83 byte per image. So I've just moved ImagingQuantHeapFree(h); call under done label. Since that time VS does not detects any leaks in my example. Also I've recompile PIL with my fix and I've checked python script which gives quantization error. Memory usage is stable now. (I've tested it under fedora10, not under windows xp yet). My python version is 2.5.2. I know a bit about PIL internals so maybe I wrong. I'd like to know PIL's author opinition about this. Thank you. P.S. median_cut with and without my fix is in attach. I did't make diff, because as I said I'm may be wrong. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: att1 Type: application/octet-stream Size: 685 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: att2 Type: application/octet-stream Size: 685 bytes Desc: not available URL: From contactatishay at gmail.com Tue Feb 10 01:08:39 2009 From: contactatishay at gmail.com (Atishay Kumar) Date: Mon, 9 Feb 2009 19:08:39 -0500 Subject: [Image-SIG] unable to import imaging c module Message-ID: <8320e6f40902091608r3952ef49u8a7ed9f1e3ea47f0@mail.gmail.com> hi i am trying to use PIL, with Django to display Captcha. This could be newbie stuff as I am new to python and PIL I am getting following error when importing ImageFont. ImportError: The _imaging C module is not installed I have the file though. [bash]# file PIL/_imaging.so PIL/_imaging.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), not stripped How could I fix this? I am able to import other stuff like Image, ImageDraw, ImageColor How can I find out version of PIL? Regards Atishay =========details======== >>> import ImageFont Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python2.5/site-packages/PIL/ImageFont.py", line 115, in class FreeTypeFont: File "/usr/local/lib/python2.5/site-packages/PIL/ImageFont.py", line 135, in FreeTypeFont def getmask2(self, text, mode="", fill=Image.core.fill): File "/usr/local/lib/python2.5/site-packages/PIL/Image.py", line 36, in __getattr__ raise ImportError("The _imaging C module is not installed") ImportError: The _imaging C module is not installed ============ -------------- next part -------------- An HTML attachment was scrubbed... URL: From tim at timhatch.com Wed Feb 11 01:25:07 2009 From: tim at timhatch.com (Tim Hatch) Date: Tue, 10 Feb 2009 16:25:07 -0800 Subject: [Image-SIG] unable to import imaging c module In-Reply-To: <8320e6f40902091608r3952ef49u8a7ed9f1e3ea47f0@mail.gmail.com> References: <8320e6f40902091608r3952ef49u8a7ed9f1e3ea47f0@mail.gmail.com> Message-ID: <8880792A-BBC0-4865-AD5D-0B403BED5E4A@timhatch.com> > ImportError: The _imaging C module is not installed What do you get when you run python -c "import PIL._imaging" How did you install PIL? Are you running a custom-compiled Python? Is the host 32-bit? Tim From luke at liftinteractive.com Wed Feb 11 21:52:33 2009 From: luke at liftinteractive.com (Luke Hutscal) Date: Wed, 11 Feb 2009 13:52:33 -0700 Subject: [Image-SIG] IOError: unable to identify image file(possibly weird EXIF data?) Message-ID: <6a8d94bd0902111252u218cd186g6690143d47b89b9f@mail.gmail.com> Hello, all. I am currently working on a Django application that uses sorl-thumbnail( http://code.google.com/p/sorl-thumbnail/) to do some image thumbnailing for us, which is using PIL to interact with the images that it thumbnails. Unfortunately, we seem to have encountered an intermittent problem: occasionally, PIL will raise an IOError: unable to identify image file with the files that we are trying to have it process. I did some digging into PIL, and determined that the error being raised is coming from JpegImagePlugin.py, at line 283(where a SyntaxError is raised if there was no marker found). I added some debugging statements around the error to see what the value of i was, and the first value that this exception occurs on is "8224". I am fairly certain that this issue is occuring because of something to do with the EXIF data embedded in the jpeg's that we are trying to work with; I have uploaded the jpegs and the EXIF data I could extract with ExifTool( http://www.sno.phy.queensu.ca/~phil/exiftool/) here: http://liftslice3.com/PIL/alexken.jpg http://liftslice3.com/PIL/alexken.exif http://liftslice3.com/PIL/DSC_0080-1_copy.jpg http://liftslice3.com/PIL/DSC_0080-1_copy.exif Does anyone know what might be going wrong here, or why PIL might be having trouble with these images? Thanks, Luke -------------- next part -------------- An HTML attachment was scrubbed... URL: From tim at timhatch.com Thu Feb 12 19:17:55 2009 From: tim at timhatch.com (Tim Hatch) Date: Thu, 12 Feb 2009 10:17:55 -0800 Subject: [Image-SIG] IOError: unable to identify image file(possibly weird EXIF data?) In-Reply-To: <6a8d94bd0902111252u218cd186g6690143d47b89b9f@mail.gmail.com> References: <6a8d94bd0902111252u218cd186g6690143d47b89b9f@mail.gmail.com> Message-ID: <9F34187E-B106-4D2C-A44F-7BCDC287EB40@timhatch.com> > Does anyone know what might be going wrong here, or why PIL might be > having trouble with these images? The issue with alexken.jpg appears to be slightly corrupt. Photoshop CS3 complains "This file contains file info data which cannot be read and has been ignored." (but still loads the EXIF and some other info). ImageMagick says "convert: Corrupt JPEG data: 22307 extraneous bytes before marker 0xe2" but still loads it. 001fd0: 06 00 00 00 00 00 07 00 06 00 00 00 01 01 00 ff ................ 001fe0: e1 7d 1f 68 74 74 70 3a 2f 2f 6e 73 2e 61 64 6f .}.http://ns.ado ff e1 (broken across the line boundary) is a marker, 0x7d1f being its length. Looking where that goes (position 0x9d00), the it's in the middle of a giant block of spaces and newlines (PIL agrees with my math here). The next thing that looks like a marker (ff e2) is at position 0xf423 (0x5723 too far). From there the markers are consistent. If you chop out that strange part, it works in PIL but Photoshop still complains. I don't know what causes it but I notice that both of your bad images were saved from Photoshop 7 on Windows. Tim From znfmail-pythonlang at yahoo.com Thu Feb 12 15:17:46 2009 From: znfmail-pythonlang at yahoo.com (znfmail-pythonlang at yahoo.com) Date: Thu, 12 Feb 2009 06:17:46 -0800 (PST) Subject: [Image-SIG] ImportError: The _imaging C module is not installed References: <8320e6f40902091608r3952ef49u8a7ed9f1e3ea47f0@mail.gmail.com> <8880792A-BBC0-4865-AD5D-0B403BED5E4A@timhatch.com> Message-ID: <378111.5816.qm@web56904.mail.re3.yahoo.com> Looks like someone else is having a problem as well from the other day with this module. Here's my problem, when trying to posterize an image with ImageOps I get the output error below when executing from my script. When I'm in the python shell and interactively executing each command the posterize process seems to work, no errors are generated. Python 2.5.1 SunOS 5.10 Here's the output when executing from the script. A copy of the script is provided next, then output of me typing in the commands manually. /path/(30): tmp.py Traceback (most recent call last): File "tmp.py", line 6, in im = ImageOps.posterize(im, 8) File "/usr/local/lib/python2.5/site-packages/PIL/ImageOps.py", line 391, in posterize return _lut(image, lut) File "/usr/local/lib/python2.5/site-packages/PIL/ImageOps.py", line 57, in _lut return image.point(lut) File "/usr/local/lib/python2.5/site-packages/PIL/Image.py", line 1094, in point self.load() File "/usr/local/lib/python2.5/site-packages/PIL/ImageFile.py", line 155, in load self.load_prepare() File "/usr/local/lib/python2.5/site-packages/PIL/ImageFile.py", line 223, in load_prepare self.im = Image.core.new(self.mode, self.size) File "/usr/local/lib/python2.5/site-packages/PIL/Image.py", line 36, in __getattr__ raise ImportError("The _imaging C module is not installed") ImportError: The _imaging C module is not installed #!/usr/local/bin/python2.5 import Image, ImageOps, sys im = Image.open('imagefile.jpg') im = ImageOps.posterize(im, 8) imData = im.histogram() i = 0 for ea in imData: if ea > ((im.size[0] * im.size[1]) / 4): print "BAD" i = i + 1 /path(31): /usr/local/bin/python2.5 Python 2.5.1 (r251:54863, May 16 2007, 19:58:05) [GCC 3.4.6] on sunos5 Type "help", "copyright", "credits" or "license" for more information. >>> import Image, ImageOps >>> im = Image.open('imagefile.jpg') >>> im = ImageOps.posterize(im, 8) -------------- next part -------------- An HTML attachment was scrubbed... URL: From frederic.mantegazza at gbiloba.org Mon Feb 16 14:38:06 2009 From: frederic.mantegazza at gbiloba.org (=?iso-8859-15?q?Fr=E9d=E9ric?=) Date: Mon, 16 Feb 2009 14:38:06 +0100 Subject: [Image-SIG] Intelligent bracketing Message-ID: <200902161438.06231.frederic.mantegazza@gbiloba.org> Hello, I'm starting a funny project (at least, part of a project): intelligent bracketing. Many DSLR have a auto bracketing mode, where you can automatically shoot additionnal pictures arround the current exposure. But usually, it is limited (3 shots, no more than +-2EV), except for high-end DSLR. Anyway, even with a full auto bracketing mode, it is not always possible to get the complete dynamic of a scene. And it is especially true when shooting panoramic pictures, which is my goal, as there are very large differences between one side to another (shooting a full-spehrical pano always implies to shoot towards the sun). The idea of intelligent bracketing is to take a first shot, analyse it, and take additionnal shots with an exposure bias: each new shot is based on the result of the previous one. So, we need to analyse the images (mainly histogram, which is easily done with PIL) to determine the next exposure bias. This is where I need some help; I'm far from a maths guru ;o) If you have some papers which can help, or some personnal knowledge, feel free to contact me, or to give some usefull tips. Thanks for reading. PS : about the complete project: it is a panohead control software, to automatically takes panoramic pictures, using a motorized panohead (in fact, a low cost astronomic mount). The software is called Papywizard, and can be found here: http://trac.gbiloba.org/papywizard It is developed with the help of Kolor, a french company selling the famous Autopano Pro software, but Papywizard is released under a free license. -- Fr?d?ric http://www.gbiloba.org From charlie at begeistert.org Tue Feb 17 10:15:15 2009 From: charlie at begeistert.org (Charlie Clark) Date: Tue, 17 Feb 2009 10:15:15 +0100 Subject: [Image-SIG] ImportError: The _imaging C module is not installed In-Reply-To: <378111.5816.qm@web56904.mail.re3.yahoo.com> References: <8320e6f40902091608r3952ef49u8a7ed9f1e3ea47f0@mail.gmail.com> <8880792A-BBC0-4865-AD5D-0B403BED5E4A@timhatch.com> <378111.5816.qm@web56904.mail.re3.yahoo.com> Message-ID: <9AE71570-E8DD-4675-8D28-960B7E8F9266@begeistert.org> Am 12.02.2009 um 15:17 schrieb znfmail-pythonlang at yahoo.com: > Looks like someone else is having a problem as well from the other > day with this module. Here's my problem, when trying to posterize an > image with ImageOps I get the output error below when executing from > my script. When I'm in the python shell and interactively executing > each command the posterize process seems to work, no errors are > generated. I don't reckon this has anything to do with PIL. You probably need to run Python in verbose mode so you can see exactly where it checks for the library. Charlie -- Charlie Clark Helmholtzstr. 20 D?sseldorf D- 40215 Tel: +49-211-938-5360 GSM: +49-178-782-6226 From johnson at pharmacy.arizona.edu Tue Feb 17 18:03:29 2009 From: johnson at pharmacy.arizona.edu (Bruce Johnson) Date: Tue, 17 Feb 2009 10:03:29 -0700 Subject: [Image-SIG] Cannot get PIL to install with jpeg support Message-ID: <00F4C884-D55B-48C9-9927-7A5ECB007662@pharmacy.arizona.edu> OS : SLES10 Both libjpeg and libjpeg-devel packages are installed, libjpeg.so files are in /usr/lib, setup.py is modified to show that. running python setup.py --force (to force recompiling) Ends up with -------------------------------------------------------------------- PIL 1.1.6 BUILD SUMMARY -------------------------------------------------------------------- version 1.1.6 platform linux2 2.6 (r26:66714, Feb 16 2009, 11:13:50) [GCC 4.1.2 20070115 (SUSE Linux)] -------------------------------------------------------------------- *** TKINTER support not available --- JPEG support ok --- ZLIB (PNG/ZIP) support ok --- FREETYPE2 support ok -------------------------------------------------------------------- Selftest.py still ends up failing on jpegs: tonic:~/html2pdf_sources/Imaging-1.1.6 # python selftest.py ***************************************************************** Failure in example: _info(Image.open("Images/lena.jpg")) from line #24 of selftest.testimage Exception raised: Traceback (most recent call last): File "./doctest.py", line 499, in _run_examples_inner exec compile(source, "", "single") in globs File "", line 1, in File "./selftest.py", line 22, in _info im.load() File "PIL/ImageFile.py", line 180, in load d = Image._getdecoder(self.mode, d, a, self.decoderconfig) File "PIL/Image.py", line 375, in _getdecoder raise IOError("decoder %s not available" % decoder_name) IOError: decoder jpeg not available 1 items had failures: 1 of 57 in selftest.testimage ***Test Failed*** 1 failures. *** 1 tests of 57 failed. The PIL README says to install the IJG jpeg library, but that isn't a library! All that package makes and installs is executable programs and man pages: tonic:~/jpeg-6b # make -n install /usr/bin/install -c cjpeg /usr/local/bin/cjpeg /usr/bin/install -c djpeg /usr/local/bin/djpeg /usr/bin/install -c jpegtran /usr/local/bin/jpegtran /usr/bin/install -c rdjpgcom /usr/local/bin/rdjpgcom /usr/bin/install -c wrjpgcom /usr/local/bin/wrjpgcom /usr/bin/install -c -m 644 ./cjpeg.1 /usr/local/man/man1/cjpeg.1 /usr/bin/install -c -m 644 ./djpeg.1 /usr/local/man/man1/djpeg.1 /usr/bin/install -c -m 644 ./jpegtran.1 /usr/local/man/man1/jpegtran.1 /usr/bin/install -c -m 644 ./rdjpgcom.1 /usr/local/man/man1/rdjpgcom.1 /usr/bin/install -c -m 644 ./wrjpgcom.1 /usr/local/man/man1/wrjpgcom.1 No library. What's wrong? -- Bruce Johnson University of Arizona College of Pharmacy Information Technology Group Institutions do not have opinions, merely customs From cannon.el at gmail.com Wed Feb 18 18:16:07 2009 From: cannon.el at gmail.com (Laura & Edward Cannon) Date: Wed, 18 Feb 2009 09:16:07 -0800 Subject: [Image-SIG] Intelligent bracketing In-Reply-To: <200902161438.06231.frederic.mantegazza@gbiloba.org> References: <200902161438.06231.frederic.mantegazza@gbiloba.org> Message-ID: On Mon, Feb 16, 2009 at 5:38 AM, Fr?d?ric wrote: > Hello, > > I'm starting a funny project (at least, part of a project): intelligent > bracketing. > > Many DSLR have a auto bracketing mode, where you can automatically shoot > additionnal pictures arround the current exposure. But usually, it is > limited (3 shots, no more than +-2EV), except for high-end DSLR. > I don't know for a fact, but my first suggestion would be to look at the number of overexposed pixels (at least one channel at 255) in an image, if there are allot (by some measure) then you need another exposure. Likewise if you have pixels that are 0 (or really small) then you need another exposure on that end. From bryan.fodness at gmail.com Wed Feb 18 21:08:07 2009 From: bryan.fodness at gmail.com (Bryan Fodness) Date: Wed, 18 Feb 2009 15:08:07 -0500 Subject: [Image-SIG] Enhancing an Image Message-ID: I am new to PIL and I am trying to enhance an image. Can someone tell me how I can get the picture from the palette? import ImageEnhance im = Image.open('C:\\Users\\bryan\\Desktop\\Untitled.gif') im = im.crop([10,750,1000,910]) im.show() enhancer = ImageEnhance.Sharpness(im) enhancer.enhance(2.0).show() Traceback (most recent call last): File "C:\Python25\pytesser_v0.0.1\clinical_data.py", line 7, in enhancer = ImageEnhance.Sharpness(im) File "C:\Python25\lib\site-packages\PIL\ImageEnhance.py", line 89, in __init__ self.degenerate = image.filter(ImageFilter.SMOOTH) File "C:\Python25\Lib\site-packages\PIL\Image.py", line 786, in filter return self._new(filter.filter(self.im)) File "C:\Python25\lib\site-packages\PIL\ImageFilter.py", line 54, in filter raise ValueError("cannot filter palette images") ValueError: cannot filter palette images From charlie at begeistert.org Wed Feb 18 21:24:50 2009 From: charlie at begeistert.org (Charlie Clark) Date: Wed, 18 Feb 2009 21:24:50 +0100 Subject: [Image-SIG] Enhancing an Image In-Reply-To: References: Message-ID: <6809B72B-B741-4F2E-BA70-580BDD618AE2@begeistert.org> Am 18.02.2009 um 21:08 schrieb Bryan Fodness: > I am new to PIL and I am trying to enhance an image. Can someone tell > me how I can get the picture from the palette? > > import ImageEnhance > > im = Image.open('C:\\Users\\bryan\\Desktop\\Untitled.gif') > im = im.crop([10,750,1000,910]) > im.show() > enhancer = ImageEnhance.Sharpness(im) > enhancer.enhance(2.0).show() Convert the image to RGB and then filter it. Charlie -- Charlie Clark Helmholtzstr. 20 D?sseldorf D- 40215 Tel: +49-211-938-5360 GSM: +49-178-782-6226 From bryan.fodness at gmail.com Thu Feb 19 16:24:55 2009 From: bryan.fodness at gmail.com (Bryan Fodness) Date: Thu, 19 Feb 2009 10:24:55 -0500 Subject: [Image-SIG] Need better quality from crop Message-ID: I am trying to extract data from a large number of images. I am trying to use pytesser, but I am not getting the desired results. I tried to recognize the entire image and it was not consistent at all. So, I cropped the picture with PIL in the sections that I am interested in, and then tried to run. The problem I am having is with the date and time block as well as the numerical data. I have tried to use the ImageEnhance and ImageFilter but I have not been able to increase the accuracy. Does anyone have any experience making the 'text' in an image easily detectable for an ocr. import ImageEnhance, ImageFilter from pytesser import * im = Image.open('C:\\Users\\bryan\\Desktop\\10-28-08.bmp') im1 = im.crop([156,105,265,120]) # Date/Time im1 = im1.convert('RGB') im2 = im.crop([380,815,430,833]) # Couch Vrt im2 = im2.convert('RGB') text1, text2 = image_to_string(im1), image_to_string(im2) >>> text1 '\n' >>> text2 'HIS\n\n' >>> -- "The game of science can accurately be described as a never-ending insult to human intelligence." - Jo?o Magueijo -------------- next part -------------- A non-text attachment was scrubbed... Name: DateTime.bmp Type: image/bmp Size: 4974 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: CouchVrt.bmp Type: image/bmp Size: 2790 bytes Desc: not available URL: From j_lozinski at yahoo.co.uk Wed Feb 18 14:43:18 2009 From: j_lozinski at yahoo.co.uk (Jonathan Lozinski) Date: Wed, 18 Feb 2009 13:43:18 +0000 (GMT) Subject: [Image-SIG] Extending/Hacking on PIL Message-ID: <204711.65817.qm@web23206.mail.ird.yahoo.com> I'm looking to add certain functionaly to PIL. I want to be doing this in C, with it being computationally expensive. (I want to play with curve adjustments and decomposing to HSV etc ala gimp). What's the best way to do this? Should I uninstall my PIL from my distro, get the source, compile and install, then make edits compile and install, or can I create a separate PIL namespace, like PIL.MyTest, which is compiled and installed separately? Any pointers to get going on this would be greatly appreciated. Jonathan -------------- next part -------------- An HTML attachment was scrubbed... URL: From encolpe.degoute at free.fr Fri Feb 20 00:34:38 2009 From: encolpe.degoute at free.fr (Encolpe Degoute) Date: Fri, 20 Feb 2009 00:34:38 +0100 Subject: [Image-SIG] A little patch to fix the installation when several tcl/tk version are installed Message-ID: <499DEC8E.8020802@free.fr> Hello, I wrote this little patch to fix the installation of Imaging 1.1.6 under my debian unstable. For more details you can read this blog entry: http://encolpe.wordpress.com/2009/02/20/fix-pil-116-installation-from-sources-under-debian/ I hope this help. Regards, -- Encolpe DEGOUTE http://encolpe.degoute.free.fr/ Logiciels libres, hockey sur glace et autres activit?s c?r?brales -------------- next part -------------- A non-text attachment was scrubbed... Name: Imaging-1.1.6-debian-installation.patch Type: text/x-diff Size: 584 bytes Desc: not available URL: From traversos at gmail.com Tue Feb 24 09:45:01 2009 From: traversos at gmail.com (Dario Traverso) Date: Tue, 24 Feb 2009 03:45:01 -0500 Subject: [Image-SIG] PIL IOError --- cannot find JPEG decoder Message-ID: I've been trying to install the Python Image Library (PIL) on my Mac OSX Leopard laptop, but have been running into some difficulties. I've built the library, using the included setup.py script. The build summary checks out ok, and sounds the option libraries to all be found. I grabbed both libjpeg and freetype2 using fink. -------------------------------------------------------------------- PIL 1.1.6 BUILD SUMMARY -------------------------------------------------------------------- version 1.1.6 platform darwin 2.5.1 (r251:54863, Jan 13 2009, 10:26:13) [GCC 4.0.1 (Apple Inc. build 5465)] -------------------------------------------------------------------- --- TKINTER support ok --- JPEG support ok --- ZLIB (PNG/ZIP) support ok --- FREETYPE2 support ok -------------------------------------------------------------------- However, I then run the included self test, and 1 out of 57 tests fails. I receive an IOError. Specifically: ***************************************************************** Failure in example: _info(Image.open("Images/lena.jpg")) from line #24 of selftest.testimage Exception raised: Traceback (most recent call last): File "./doctest.py", line 499, in _run_examples_inner exec compile(source, "", "single") in globs File "", line 1, in File "./selftest.py", line 22, in _info im.load() File "PIL/ImageFile.py", line 180, in load d = Image._getdecoder(self.mode, d, a, self.decoderconfig) File "PIL/Image.py", line 375, in _getdecoder raise IOError("decoder %s not available" % decoder_name) IOError: decoder jpeg not available 1 items had failures: 1 of 57 in selftest.testimage ***Test Failed*** 1 failures. *** 1 tests of 57 failed. I've followed all of the installation instructions exactly. The build summary reported everything was "ok". What could be the problem here. Libjpeg-6b is not accessible? I've attached an image of my console output... Thank you for any insight you can provide!! -Dario -------------- next part -------------- A non-text attachment was scrubbed... Name: PIL_Trouble.jpg Type: image/jpeg Size: 267017 bytes Desc: not available URL: From rosemann at imkt.uni-hannover.de Thu Feb 26 15:38:08 2009 From: rosemann at imkt.uni-hannover.de (Harald Rosemann) Date: Thu, 26 Feb 2009 15:38:08 +0100 Subject: [Image-SIG] problem in installing pil Message-ID: <49A6A950.2030005@imkt.uni-hannover.de> Hallo! Can You please tell me, what's wrong here? I am on _openSUSE 11.0_ with _python 2.5.2_. I got _Imaging-1.1.6_. I called: _python setup.py build_ext -i_ I got the message: _imagingtk.c:20:16: error: tk.h: Datei oder Verzeichnis nicht gefunden _imagingtk.c:23: error: expected ?)? before ?*? token _imagingtk.c:31: error: expected specifier-qualifier-list before ?Tcl_Interp? _imagingtk.c: In function ?_tkinit?: _imagingtk.c:37: error: ?Tcl_Interp? undeclared (first use in this function) _imagingtk.c:37: error: (Each undeclared identifier is reported only once _imagingtk.c:37: error: for each function it appears in.) _imagingtk.c:37: error: ?interp? undeclared (first use in this function) _imagingtk.c:45: error: expected expression before ?)? token _imagingtk.c:51: error: ?TkappObject? has no member named ?interp? _imagingtk.c:55: warning: implicit declaration of function ?TkImaging_Init? error: command 'gcc' failed with exit status 1 Where is my fault? With best regards Harald Rosemann From karsten.hiddemann at mathematik.uni-dortmund.de Thu Feb 26 15:46:52 2009 From: karsten.hiddemann at mathematik.uni-dortmund.de (Karsten Hiddemann) Date: Thu, 26 Feb 2009 15:46:52 +0100 Subject: [Image-SIG] problem in installing pil In-Reply-To: <49A6A950.2030005@imkt.uni-hannover.de> References: <49A6A950.2030005@imkt.uni-hannover.de> Message-ID: <49A6AB5C.4040302@mathematik.uni-dortmund.de> Harald Rosemann schrieb: > I got the message: > > _imagingtk.c:20:16: error: tk.h: Datei oder Verzeichnis nicht gefunden Make sure that you have Tcl/Tk installed. Cheers, Karsten From fredrik at pythonware.com Thu Feb 26 16:22:27 2009 From: fredrik at pythonware.com (Fredrik Lundh) Date: Thu, 26 Feb 2009 16:22:27 +0100 Subject: [Image-SIG] problem in installing pil In-Reply-To: <49A6A950.2030005@imkt.uni-hannover.de> References: <49A6A950.2030005@imkt.uni-hannover.de> Message-ID: <368a5cd50902260722h624aaefaueeb20a9e12967ec4@mail.gmail.com> Ah, the beauty of partial localization (but google do have a few posts that explain how to fix this also for the german error message, so that's no excuse for not googling before posting ;-). Anyway, as others have pointed out (and I'm pretty sure it's mentioned in the build docs too), you need the Tcl/Tk development files to be able to build the Tk interface. To fix this, either install tcl-dev/tk-dev (or whatever the packages are called on your machine), or tweak setup.py to skip that part of the process. On Thu, Feb 26, 2009 at 3:38 PM, Harald Rosemann wrote: > Hallo! > > Can You please tell me, > what's wrong here? > > I am on _openSUSE 11.0_ with > _python 2.5.2_. > > I got _Imaging-1.1.6_. > I called: ?_python setup.py build_ext -i_ > > I got the message: > > _imagingtk.c:20:16: error: tk.h: Datei oder Verzeichnis nicht gefunden > _imagingtk.c:23: error: expected ?)? before ?*? token > _imagingtk.c:31: error: expected specifier-qualifier-list before > ?Tcl_Interp? > _imagingtk.c: In function ?_tkinit?: > _imagingtk.c:37: error: ?Tcl_Interp? undeclared (first use in this function) > _imagingtk.c:37: error: (Each undeclared identifier is reported only once > _imagingtk.c:37: error: for each function it appears in.) > _imagingtk.c:37: error: ?interp? undeclared (first use in this function) > _imagingtk.c:45: error: expected expression before ?)? token > _imagingtk.c:51: error: ?TkappObject? has no member named ?interp? > _imagingtk.c:55: warning: implicit declaration of function ?TkImaging_Init? > error: command 'gcc' failed with exit status 1 > > Where is my fault? > > With best regards > Harald Rosemann > _______________________________________________ > Image-SIG maillist ?- ?Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > From ask at jillion.dk Fri Feb 27 19:08:32 2009 From: ask at jillion.dk (Ask Holme) Date: Fri, 27 Feb 2009 19:08:32 +0100 Subject: [Image-SIG] playing with CMYK images Message-ID: -- Ask Holme - 28 76 98 87 -------------- next part -------------- An HTML attachment was scrubbed... URL: From ask at jillion.dk Fri Feb 27 19:09:54 2009 From: ask at jillion.dk (Ask Holme) Date: Fri, 27 Feb 2009 19:09:54 +0100 Subject: [Image-SIG] playing with CMYK images Message-ID: Hey list i have just tried using PIL to crop and resize CMYK images (with CMYK as end result, no color mode conversion). I must say i was surprised how awfull the result look. Even though PIL is not supposed to touch the color mode, colors is totally fucked up in the modified image. Is that because i'm doing something wrong or is the only solution simply to switch to imagemagick if i want better CMYK support -- Ask Holme - 28 76 98 87 -- Ask Holme - 28 76 98 87 -------------- next part -------------- An HTML attachment was scrubbed... URL: