From ned at nedbatchelder.com Sun Feb 3 01:14:40 2008 From: ned at nedbatchelder.com (Ned Batchelder) Date: Sat, 02 Feb 2008 19:14:40 -0500 Subject: [Image-SIG] Fix for left bearing of first character in a string Message-ID: <47A50770.9060907@nedbatchelder.com> In PIL 1.1.6, ImageDraw.text will position the string incorrectly if the first character has a negative left bearing. To see the problem, show a string like "///" in an italic font. The first slash will be clipped at the left, and the string will be mis-positioned. This patch fixes it: --- C:\src\PIL\Imaging-1.1.6\_imagingft.c 2006-12-03 06:51:26.000000000 -0500 +++ C:\src\PIL\mine\_imagingft.c 2008-02-02 16:39:20.000000000 -0500 @@ -316,13 +316,13 @@ load_flags = FT_LOAD_RENDER; if (mask) load_flags |= FT_LOAD_TARGET_MONO; for (x = i = 0; font_getchar(string, i, &ch); i++) { if (i == 0 && self->face->glyph->metrics.horiBearingX < 0) - x = PIXEL(self->face->glyph->metrics.horiBearingX); + x = -PIXEL(self->face->glyph->metrics.horiBearingX); index = FT_Get_Char_Index(self->face, ch); if (kerning && last_index && index) { FT_Vector delta; FT_Get_Kerning(self->face, last_index, index, ft_kerning_default, &delta); x += delta.x >> 6; --Ned. -- Ned Batchelder, http://nedbatchelder.com From ned at nedbatchelder.com Sun Feb 3 19:48:49 2008 From: ned at nedbatchelder.com (Ned Batchelder) Date: Sun, 03 Feb 2008 13:48:49 -0500 Subject: [Image-SIG] Help with building on Windows? Message-ID: <47A60C91.8070209@nedbatchelder.com> I need to build Imaging-1.1.6 on Windows. I've downloaded what I thought were the right packages from GnuWin32: freetype-2.3.5-bin freetype-2.3.5-lib jpeg-6b-4-bin jpeg-6b-4-lib zlib-1.2.3-bin zlib-1.2.3-lib I edited the setup.py to add the GnuWin32 include and lib directories to the search path. When I run "setup.py build_ext" though, it decides that zlib support is available, but freetype and jpeg support are not. Looking through the code, it finds libz.a in the GnuWin32 directory, but there is no similar libjpeg.a or libfreetype.a, so it decides those features aren't available. Other libraries it would accept for jpeg support are: libjpeg.dylib, jpeg.dll, libjpeg.a, liblibjpeg.dylib, libjpeg.dll, or liblibjpeg.a. None of these are present. Searching for information, I see many cryptic pages discussing a2dll, o2dll, dlltool, and so on. I don't understand them. Each time I try a new set of instructions, it points me to another piece of software I don't think I have, and don't know how to get. I feel like a total noob. Can someone help? --Ned. -- Ned Batchelder, http://nedbatchelder.com From Dennis.Kepler at dnr.state.mn.us Fri Feb 1 18:54:48 2008 From: Dennis.Kepler at dnr.state.mn.us (Dennis Kepler) Date: Fri, 01 Feb 2008 11:54:48 -0600 Subject: [Image-SIG] memory flush?&In-Reply-To= Message-ID: <47A3080B.E69C.0098.0@dnr.state.mn.us> Mark, Did you get an answer or did you figure out your MemoryError issue concerning the python program you sent to Image-SIG on June 14, 2007? I seem to be having the same type of problem, except all I'm doing is applying a contrast enhancement to a .tiff or .jpg. I get this error: return im1._new(core.blend(im1.im, im2.im, alpha)) MemoryError My code looks like this: import sys, os import glob, time import Image, ImageDraw, ImageFont import ImageEnhance os.chdir('D:/Ortho/jpg_outputs/cem/test/') #set image list by a glob search img_list = glob.glob('*.jpg') # Start the loop of the images to be resized for img in img_list: name = img im = Image.open(img) enh = ImageEnhance.Contrast(im) enh.enhance(1.3).show("30% more contrast") #Save full resolution jpeg try: im.save('D:/ortho/jpg_outputs/cem/test/output/' + name[0:8] + ".jpg") except IOError: print "cannot export", name Any Ideas? Thanks. Dennis Kepler Remote Sensing Analyst MN DNR Forestry/Resource Assessment 413 SE 13th Street, Grand Rapids MN 55744 (218)327-4449 ext. 253, fax -4517 dennis.kepler at dnr.state.mn.us -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20080201/670b9b61/attachment.htm From Dennis.Kepler at dnr.state.mn.us Fri Feb 1 18:57:41 2008 From: Dennis.Kepler at dnr.state.mn.us (Dennis Kepler) Date: Fri, 01 Feb 2008 11:57:41 -0600 Subject: [Image-SIG] Memory Error Message-ID: <47A308B7.E69C.0098.0@dnr.state.mn.us> I seem to be having a memory problem, except all I'm doing is applying a contrast enhancement to a .tiff or .jpg. I get this error: return im1._new(core.blend(im1.im, im2.im, alpha)) MemoryError The JPEG is about 45mb. The TIFF is about 600mb. My code looks like this: import sys, os import glob, time import Image, ImageDraw, ImageFont import ImageEnhance os.chdir('D:/Ortho/jpg_outputs/cem/test/') #set image list by a glob search img_list = glob.glob('*.jpg') # Start the loop of the images to be resized for img in img_list: name = img im = Image.open(img) enh = ImageEnhance.Contrast(im) enh.enhance(1.3).show("30% more contrast") #Save full resolution jpeg try: im.save('D:/ortho/jpg_outputs/cem/test/output/' + name[0:8] + ".jpg") except IOError: print "cannot export", name Any ideas? Dennis Kepler Remote Sensing Analyst MN DNR Forestry/Resource Assessment 413 SE 13th Street, Grand Rapids MN 55744 (218)327-4449 ext. 253, fax -4517 dennis.kepler at dnr.state.mn.us -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20080201/ce6c9686/attachment.htm From fredrik at pythonware.com Mon Feb 4 18:00:47 2008 From: fredrik at pythonware.com (Fredrik Lundh) Date: Mon, 04 Feb 2008 18:00:47 +0100 Subject: [Image-SIG] Memory Error In-Reply-To: <47A308B7.E69C.0098.0@dnr.state.mn.us> References: <47A308B7.E69C.0098.0@dnr.state.mn.us> Message-ID: Dennis Kepler wrote: > I seem to be having a memory problem, except all I'm doing is applying a > contrast enhancement to a .tiff or .jpg. I get this error: *return > im1._new(core.blend(im1.im, im2.im, alpha)) MemoryError* > ** > The JPEG is about 45mb. > The TIFF is about 600mb. > > My code looks like this: > import sys, os > import glob, time > import Image, ImageDraw, ImageFont > import ImageEnhance > > os.chdir('D:/Ortho/jpg_outputs/cem/test/') > > #set image list by a glob search > img_list = glob.glob('*.jpg') > > # Start the loop of the images to be resized > for img in img_list: > name = img > im = Image.open(img) > enh = ImageEnhance.Contrast(im) > enh.enhance(1.3).show("30% more contrast") > > #Save full resolution jpeg > try: > im.save('D:/ortho/jpg_outputs/cem/test/output/' + name[0:8] + > ".jpg") > except IOError: > print "cannot export", name > > Any ideas? use the windows task manager to check how quickly memory grows; do you run out of memory after one images, five, ten? how much memory does each loop need? also, note that ImageEnhance isn't a very memory efficient way to process large images; the constructor makes *two* copies of the source image, and the enhance method generates a third one. try using the "point" method instead. From fredrik at pythonware.com Mon Feb 4 18:04:32 2008 From: fredrik at pythonware.com (Fredrik Lundh) Date: Mon, 04 Feb 2008 18:04:32 +0100 Subject: [Image-SIG] Make the difference between a picture and a photo In-Reply-To: <52e42efe0801300051saa0721bre672ffac18c6541d@mail.gmail.com> References: <52e42efe0801291656i3b8c149cn6b4e2190f0c40527@mail.gmail.com> <52e42efe0801300051saa0721bre672ffac18c6541d@mail.gmail.com> Message-ID: Seed wrote: > Is there a way with or without PIL python librairy to detect if an > image looks like a picture more than a photography and the opposite? assuming you mean a (computer) drawing vs. a photo, a simple way is to count the number of colors in the image. you can use the "getcolors" method with a suitable limit: http://mail.python.org/pipermail/image-sig/2008-January/004754.html (this doesn't necessarily work for scanned art or more "photorealistic" graphics, of course.) From spe.stani.be at gmail.com Tue Feb 5 20:27:02 2008 From: spe.stani.be at gmail.com (Stani) Date: Tue, 5 Feb 2008 20:27:02 +0100 Subject: [Image-SIG] ANN: PHATCH, a PHoto bATCH processor and renamer based on PIL Message-ID: <2078a7ad0802051127p59a932ean1ffddcb6f536d3a@mail.gmail.com> As a visual artist I needed an easy tool for batch processing images on Ubuntu. For a while I was using ImageMagick, but I found writing complex operations on the command line quite a hassle and wanted to write the image operations in python. As a result I'm pleased to announce the release of Phatch which is a powerful batch processor and renamer. Phatch exposes a big part of the Python Imaging Library through an user friendly GUI. (It is using python-pyexiv2 to offer more extensive EXIF and IPTC support.) Phatch is not targeted at manipulating individual pictures (such as with Gimp), but repeating the same actions on hundreds or thousands of images. If you know PIL and have some nice recipes laying around, it is very easy to write plugins as Phatch generates the corresponding GUI automagically just like in Django. Any existings PIL scripts can be added very easily. Let me know if you want to contribute or have any questions. Homepage: http://photobatch.stani.be (free download link below) Tutorials: http://photobatch.wikidot.com/tutorials Translations: https://translations.launchpad.net/phatch/trunk/+pots/phatch License: GPLv3 Screenshot: http://photobatch.wikidot.com/local--files/start/Screenshot-Phatch3d.jpg (the perspective and reflection is produced by Phatch itself) Phatch has many features, like: - EXIF information inspector with thumbnail - limit jpeg file size when saving - tons of actions organized by tags (including perspective, round corners, shadow, reflection, ...) - console version (Phatch can now run without a gui on servers) - batch rename and copy files based on exif metadata - data stamping (http://photobatch.wikidot.com) - online documentation wiki (http://photobatch.wikidot.com) Linux only features: - desktop or panel droplets on which images or folders can be dropped (will be ported to Windows & Mac) - Nautilus and desktop integration (with its own mime type and nautilus extension) - manpage with examples With python-pyexiv2 the following featues are added: - embedding the original EXIF and IPTC tags in the image All actions mostly have a separate pil function in their source code, so they could be read as a recipe book for PIL: * Auto Contrast - Maximize image contrast * Background - Put colour under transparent image * Border - Crop or add border to all sides * Brightness - Adjust brightness from black to white * Canvas - Crop the image or enlarge canvas without resizing the image * Colorize - Colorize grayscale image * Common - Copies the most common pixel value * Contrast - Adjust from grey to black & white * Convert Mode - Convert the color mode of an image (grayscale, RGB, RGBA or CMYK) * Copy - Copy image file * Effect - Blur, Sharpen, Emboss, Smooth, ? * Equalize - Equalize the image histogram * Fit - Downsize and crop image with fixed ratio * Grayscale - Fade all colours to gray * Invert - Invert the colors of the image (negative) * Maximum - Copies the maximum pixel value * Mask - Apply a transparency mask * Median - Copies the median pixel value * Minimum - Copies the minimum pixel value * Offset - Offset by distance and wrap around * Posterize - Reduce the number of bits of colour channel * Perspective - Shear 2d or 3d * Rank - Copies the rank'th pixel value * Reflect - Drops a reflection * Rename - Rename image file * Rotate - Rotate with random angle * Round - Round or crossed corners with variable radius and corners * Saturation - Adjust saturation from grayscale to high * Save - Save an image with variable compression in different types * Scale - Scale an image with different resample filters. * Shadow - Drop a blurred shadow under a photo with variable position, blur and color * Solarize - Invert all pixel values above threshold * Text - Write text at a given position * Transpose - Flip or rotate an image by 90 degrees * Watermark - Apply a watermark image with variable placement (offset, scaling, tiling) and opacity I develop Phatch on Ubuntu/Linux, but I have tested and polished it regularly on Windows and Mac Os X. (Only the droplet functionality needs to be ported.) Phatch is submitted to Debian, and if accepted will be available in all Debian derivate distributions such as Ubuntu. Requirements: - PIL 1.1.5 or higher - wxPython 2.6 or higher - pyexiv2 (optional) - python nautilus bindings (optional) Best regards, Stani -- http://pythonide.stani.be From janssen at parc.com Tue Feb 5 20:37:11 2008 From: janssen at parc.com (Bill Janssen) Date: Tue, 5 Feb 2008 11:37:11 PST Subject: [Image-SIG] can't build JPEG support with PIL 1.1.6 Message-ID: <08Feb5.113716pst."58696"@synergy1.parc.xerox.com> Odd thing going on here. I've got libjpeg built and installed, with include files, under /local, on a PowerPC Mac, running 10.4.11, which means Python 2.3.5. I unpack Imaging-1.1.6, edit setup.py to tell it where to find libjpeg, and do the build: wjanssen % python setup.py build running build running build_py creating build creating build/lib.darwin-8.11.0-Power_Macintosh-2.3 copying PIL/__init__.py -> build/lib.darwin-8.11.0-Power_Macintosh-2.3 copying PIL/ArgImagePlugin.py -> build/lib.darwin-8.11.0-Power_Macintosh-2.3 [...] -------------------------------------------------------------------- PIL 1.1.6 BUILD SUMMARY -------------------------------------------------------------------- version 1.1.6 platform darwin 2.3.5 (#1, Oct 5 2005, 11:07:27) [GCC 3.3 20030304 (Apple Computer, Inc. build 1809)] -------------------------------------------------------------------- --- TKINTER support ok --- JPEG support ok --- ZLIB (PNG/ZIP) support ok --- FREETYPE2 support ok -------------------------------------------------------------------- To check the build, run the selftest.py script. running build_scripts [...] wjanssen % 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. wjanssen % From gooli at testuff.com Wed Feb 6 17:42:51 2008 From: gooli at testuff.com (Eli Golovinsky) Date: Wed, 6 Feb 2008 18:42:51 +0200 Subject: [Image-SIG] Patch: improved PNG saving speed Message-ID: <89c44a300802060842n6ccecf33u366ae7bd8ba85033@mail.gmail.com> Hi, I'm working on a screen capturing program and I noticed that it takes quite a while for PIL to save PNG images. I ran a profiler on the library and saw that the code that filters the PNG data (lines 133 to 234 in ZipEncode.c) takes about half of the entire compression time. Removing it speeded up the saving considerably and only increased the resulting files by about 25%. I added an option to the save method called 'no_filter' that prevents the filter code from running. I'm attaching a patch made against the 1.1.6 source kit (http://effbot.org/downloads/Imaging-1.1.6.tar.gz). Maybe somebody will find it useful someday. -- Eli Golovinsky www.testuff.com -------------- next part -------------- A non-text attachment was scrubbed... Name: pil-png-no_filter.patch Type: application/octet-stream Size: 1324 bytes Desc: not available Url : http://mail.python.org/pipermail/image-sig/attachments/20080206/d917a671/attachment.obj From tanthiamhuat at yahoo.com Mon Feb 11 09:46:17 2008 From: tanthiamhuat at yahoo.com (TAN TH) Date: Mon, 11 Feb 2008 00:46:17 -0800 (PST) Subject: [Image-SIG] matlab vs Python for Image Processing applications Message-ID: <535630.89540.qm@web55212.mail.re4.yahoo.com> which is more suitable software for Image Processing applications, Matlab or Python? I have tried something very simple in Python, which is from the pdf, http://www.pythonware.com/media/data/pil-handbook.pdf however, it gives error. anyone able to help? >>> import Image >>> im = Image.open("D:/test.gif") >>> print im.format, im.size, im.mode GIF (409, 460) P >>> r, g, b = im.split() Traceback (most recent call last): File "", line 1, in r, g, b = im.split() ValueError: need more than 1 value to unpack ____________________________________________________________________________________ Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs From douglas at paradise.net.nz Mon Feb 11 21:22:43 2008 From: douglas at paradise.net.nz (Douglas Bagnall) Date: Tue, 12 Feb 2008 09:22:43 +1300 Subject: [Image-SIG] matlab vs Python for Image Processing applications In-Reply-To: <535630.89540.qm@web55212.mail.re4.yahoo.com> References: <535630.89540.qm@web55212.mail.re4.yahoo.com> Message-ID: <47B0AE93.70203@paradise.net.nz> TAN TH wrote: >>>> import Image >>>> im = Image.open("D:/test.gif") >>>> print im.format, im.size, im.mode > GIF (409, 460) P The "P" is telling you that the image is in palette mode (as all gifs are), but here you are assuming it is RGB mode: >>>> r, g, b = im.split() What you really want is r, g, b = im.convert("RGB").split() > which is more suitable software for Image Processing > applications, Matlab or Python? It depends what you are doing, what you are used to, and whether you need to share it (Matlab is unavailable to many people). Douglas From gwidion at mpc.com.br Mon Feb 11 21:29:11 2008 From: gwidion at mpc.com.br (Joao S. O. Bueno) Date: Mon, 11 Feb 2008 17:29:11 -0300 Subject: [Image-SIG] matlab vs Python for Image Processing applications In-Reply-To: <47B0AE93.70203@paradise.net.nz> References: <535630.89540.qm@web55212.mail.re4.yahoo.com> <47B0AE93.70203@paradise.net.nz> Message-ID: <200802111729.11403.gwidion@mpc.com.br> On Monday 11 February 2008, Douglas Bagnall wrote: > TAN TH wrote: > >>>> import Image > >>>> im = Image.open("D:/test.gif") > >>>> print im.format, im.size, im.mode > > > > GIF (409, 460) P > > The "P" is telling you that the image is in palette mode (as all > gifs > > are), but here you are assuming it is RGB mode: > >>>> r, g, b = im.split() > > What you really want is > > r, g, b = im.convert("RGB").split() > > > which is more suitable software for Image Processing > > applications, Matlab or Python? > > It depends what you are doing, what you are used to, and whether > you need to share it (Matlab is unavailable to many people). > And actually,a sbeyond PIL there is SciPY - a bundle of scientific modules for python which agregates most matlab functions and much more to pythojn, I hardle would see matlab as a better option in ay case. http://www.scipy.org/ - js -><- > Douglas > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig From wrybread at gmail.com Mon Feb 11 11:31:14 2008 From: wrybread at gmail.com (Alec Bennett) Date: Mon, 11 Feb 2008 02:31:14 -0800 Subject: [Image-SIG] matlab vs Python for Image Processing applications In-Reply-To: <535630.89540.qm@web55212.mail.re4.yahoo.com> References: <535630.89540.qm@web55212.mail.re4.yahoo.com> Message-ID: Python, of course! Just kidding, I don't know enough about Matlab to answer that question well. Python's great for image processing though. As far as your code, my guess is the output of split() when fed a gif isn't in r g b format? Try running your code on a JPEG, works just fine. But with a GIF I get the error too. Here's the output of slightly different code: import Image im = Image.open("test2.gif") print im.split() > (,) As you can see, it's returning a single item list, so when you assign three items to the output, you're getting the error. As far as why the output of split() is so different for a GIF vs. JPEG, I don't know. On Mon, Feb 11, 2008 at 12:46 AM, TAN TH wrote: > which is more suitable software for Image Processing > applications, Matlab or Python? > > I have tried something very simple in Python, which is > from the pdf, > http://www.pythonware.com/media/data/pil-handbook.pdf > however, it gives error. anyone able to help? > > >>> import Image > >>> im = Image.open("D:/test.gif") > >>> print im.format, im.size, im.mode > GIF (409, 460) P > >>> r, g, b = im.split() > > Traceback (most recent call last): > File "", line 1, in > r, g, b = im.split() > ValueError: need more than 1 value to unpack > > > > ____________________________________________________________________________________ > Never miss a thing. Make Yahoo your home page. > http://www.yahoo.com/r/hs > _______________________________________________ > 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/20080211/0ed872ac/attachment-0001.htm From newz at bearfruit.org Mon Feb 11 18:00:26 2008 From: newz at bearfruit.org (Matthew Nuzum) Date: Mon, 11 Feb 2008 11:00:26 -0600 Subject: [Image-SIG] matlab vs Python for Image Processing applications In-Reply-To: <535630.89540.qm@web55212.mail.re4.yahoo.com> References: <535630.89540.qm@web55212.mail.re4.yahoo.com> Message-ID: If there's something you want to do and you know how to do it in matlab and you only need to do it once you may be best off using matlab. It will take 1 min to program and 10 min to run. If you can't get the right visualization and want the flexibility and power of writing the tool yourself there will be a steep learning curve but once you get proficient it will take 10 min to write and will run in 1 min. Also, you may want to investigate scilab. Regarding your image, try it with something other than a gif, they have a special color pallete and there's an extra step when working with them. On Feb 11, 2008 2:46 AM, TAN TH wrote: > which is more suitable software for Image Processing > applications, Matlab or Python? > > I have tried something very simple in Python, which is > from the pdf, > http://www.pythonware.com/media/data/pil-handbook.pdf > however, it gives error. anyone able to help? > > >>> import Image > >>> im = Image.open("D:/test.gif") > >>> print im.format, im.size, im.mode > GIF (409, 460) P > >>> r, g, b = im.split() > > Traceback (most recent call last): > File "", line 1, in > r, g, b = im.split() > ValueError: need more than 1 value to unpack > > > > ____________________________________________________________________________________ > Never miss a thing. Make Yahoo your home page. > http://www.yahoo.com/r/hs > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > -- Matthew Nuzum newz2000 on freenode -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20080211/644eeab3/attachment-0001.htm From ivzem at rambler.ru Tue Feb 12 11:01:16 2008 From: ivzem at rambler.ru (=?windows-1251?B?yOLg7SDH5ez27uI=?=) Date: Tue, 12 Feb 2008 13:01:16 +0300 Subject: [Image-SIG] Errors when installing PIL Message-ID: <1002483647.1202810476.157837356.12909@mcgi57.rambler.ru> Goog day! I have erors when installing PIL. uname -a Linux ffzema 2.6.22-14-generic #1 SMP Sun Oct 14 23:05:12 GMT 2007 i686 GNU/Linux gcc-4.1 In the attached file errors at compile -- Sincerely, Ivan Zemtsov -------------- next part -------------- A non-text attachment was scrubbed... Name: error_PIL Type: application/octet-stream Size: 58126 bytes Desc: not available Url : http://mail.python.org/pipermail/image-sig/attachments/20080212/04fb187a/attachment-0001.obj From bharathv6 at gmail.com Tue Feb 12 12:10:47 2008 From: bharathv6 at gmail.com (bharath venkatesh) Date: Tue, 12 Feb 2008 16:40:47 +0530 Subject: [Image-SIG] installing problem pls help me Message-ID: <910313af0802120310o5eb1ab32g18788a24d2efad03@mail.gmail.com> hi I was very much excited when i saw pil(python imaging library) as i require it for my project ..i successfully downloaded PIL 1.1.6 source kit(all platforms) from the site http://www.pythonware.com/products/pil/ as i am using ubuntu linux os and python 2.5.1 interpreter.. then i did the following steps mentioned in readme filei.e $ cd Python-2.4/Extensions # example $ gunzip Imaging-1.1.6.tar.gz $ tar xvf Imaging-1.1.6.tar $ cd Imaging-1.1.6 $ python setup.py build_ext -i but i am gettting the following errors as shown below i am not able to figure out ... and i should hurry up with my project so some one pls help me .error message is shown below running build_ext building '_imaging' extension gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O2 -Wall -Wstrict-prototypes -fPIC -IlibImaging -I/usr/include -I/usr/local/include -I/usr/include/python2.5 -c _imaging.c -o build/temp.linux-i686-2.5 /_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 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20080212/8b4c0b65/attachment-0001.htm From bharathv6 at gmail.com Tue Feb 12 12:39:46 2008 From: bharathv6 at gmail.com (bharath venkatesh) Date: Tue, 12 Feb 2008 17:09:46 +0530 Subject: [Image-SIG] installation problem Message-ID: <910313af0802120339l12779d64rb2bf767705f1a8b3@mail.gmail.com> hi I was very much excited when i saw pil(python imaging library) as i require it for my project ..i successfully downloaded PIL 1.1.6 source kit(all platforms) from the site http://www.pythonware.com/products/pil/ as i am using ubuntu linux os and python 2.5.1 interpreter.. then i did the following steps mentioned in readme filei.e $ cd Python-2.4/Extensions # example $ gunzip Imaging-1.1.6.tar.gz $ tar xvf Imaging-1.1.6.tar $ cd Imaging-1.1.6 $ python setup.py build_ext -i but i am gettting the following errors as shown below i am not able to figure out ... and i should hurry up with my project so some one pls help me .error message is shown below running build_ext building '_imaging' extension gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O2 -Wall -Wstrict-prototypes -fPIC -IlibImaging -I/usr/include -I/usr/local/include -I/usr/include/python2.5 -c _imaging.c -o build/temp.linux-i686-2.5 /_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 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20080212/380f2945/attachment-0001.htm From fcodvpt at gmail.com Tue Feb 12 14:52:11 2008 From: fcodvpt at gmail.com (=?ISO-8859-1?Q?Fran=E7oise_CONIL?=) Date: Tue, 12 Feb 2008 14:52:11 +0100 Subject: [Image-SIG] can't build JPEG support with PIL 1.1.6 too Message-ID: Hi, I am joining the list to submit the same problem than Bill Janssen. I have an intel (Intel Core 2 Duo 2.4 GHz) macbook with leopard (10.5.2 now) and I do not succeed in installing PIL with jpeg support. I am a new mac user, I searched the net for hours and what I tried did not succeed so I am asking you some help. I tryied the following way : http://wiki.python.org/moin/MacPython/UniversalLibrariesAndExtensions "sudo make install-lib" for PIL finds all libraries : Tkiter, jpeg, zlib and freetype2 But "python selftest.py" fails : ***************************************************************** 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 also tryied the following trick : http://www.modpython.org/pipermail/mod_python/2007-November/024438.html I saw the following way of installing jpeg library : http://www.kyngchaos.com/wiki/macosx:build:libjpeg ... but I hesitate patching my system from an unknown source Is it possible to have PIL working with leopard ? If so, what sould I do ? Fran?oise -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20080212/ee191b41/attachment-0001.htm From bharathv6 at gmail.com Wed Feb 13 07:56:03 2008 From: bharathv6 at gmail.com (bharath venkatesh) Date: Wed, 13 Feb 2008 12:26:03 +0530 Subject: [Image-SIG] image caching using pil Message-ID: <910313af0802122256l73ff08d3w9ddd62e3ef9281ec@mail.gmail.com> hi is it possible to cache image , access the image from the cache , modify the image and store it back in the cache with out having to store the image in disk using pil.. if so let me know how to do it . otherwise please suggest a alternative ... thanking you bharath -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20080213/1784b9b3/attachment.htm From nadavh at visionsense.com Wed Feb 13 14:05:03 2008 From: nadavh at visionsense.com (Nadav Horesh) Date: Wed, 13 Feb 2008 15:05:03 +0200 Subject: [Image-SIG] Can not read a special type of tif images Message-ID: <710F2847B0018641891D9A21602763600B6EC5@ex3.envision.co.il> I have a set of tif images that generated for a dicom images using ImageMagic convert utility. The Image module does not identify them (even identify utility seems to be inconsistent about them, as shown below): Try to read image via Image module =================================== In [2]: import Image In [3]: Image.VERSION Out[3]: '1.1.6' In [6]: im = Image.open('disk1_00_00_00_ct000104.tif') --------------------------------------------------------------------------- IOError Traceback (most recent call last) /home/nadav/Dubi_feb_2008/ in () /usr/lib64/python2.5/site-packages/PIL/Image.py in open(fp, mode) 1914 pass 1915 -> 1916 raise IOError("cannot identify image file") 1917 1918 # Ioerror: cannot identify image file Use identify to tell the imsge type (claims 16 bits image) =========================================================== nadav at nadav_home ~/Dubi_feb_2008 $ identify disk1_00_00_00_ct000104.tif disk1_00_00_00_ct000104.tif TIFF 512x666 512x666+0+0 DirectClass 16-bit 1.95405mb Use VERBOSE identify to tell the imsge type (claims 3 channels of 8 bits image) ================================================================================= nadav at nadav_home ~/Dubi_feb_2008 $ identify -verbose disk1_00_00_00_ct000104.tifImage: disk1_00_00_00_ct000104.tif Format: TIFF (Tagged Image File Format) Class: DirectClass Geometry: 512x666+0+0 Type: TrueColor Endianess: MSB Colorspace: RGB Depth: 8-bit Channel depth: Red: 8-bit Green: 8-bit Blue: 8-bit Channel statistics: Red: Min: 0 (0) Max: 255 (1) Mean: 23.9858 (0.094062) Standard deviation: 54.0234 (0.211857) Green: Min: 0 (0) Max: 255 (1) Mean: 23.9649 (0.0939799) Standard deviation: 53.9348 (0.211509) Blue: Min: 0 (0) Max: 255 (1) Mean: 23.9279 (0.0938347) Standard deviation: 53.9765 (0.211673) Rendering intent: Undefined Resolution: 72x72 Units: Undefined Filesize: 1.95405mb Interlace: None Background color: white Border color: rgb(223,223,223) Matte color: grey74 Transparent color: black Page geometry: 512x666+0+0 Dispose: Undefined Iterations: 0 Compression: None Orientation: TopLeft Signature: 0b119af1944ffba9285d903f89bc4021e52686570b8bc519f3e653a0dfd05445 Tiff:document: /home/nadav/Dubi_feb_2008/disk1_00_00_00_ct000104.tif Tiff:rows-per-strip: 2 Tiff:software: ImageMagick 6.3.5 11/04/07 Q16 http://www.imagemagick.org Tainted: False Version: ImageMagick 6.3.5 11/04/07 Q16 http://www.imagemagick.org Nadav. From gfiske at whrc.org Wed Feb 13 22:07:31 2008 From: gfiske at whrc.org (Greg Fiske) Date: Wed, 13 Feb 2008 16:07:31 -0500 Subject: [Image-SIG] image math Message-ID: <003001c86e84$735d9370$5a18ba50$@org> Greetings, I'm a new python user, so pardon my simple question. I'd like to do some simple raster math within Python. For example, I'd like to read in 2 Geotiffs and add one to the other -- creating a new output Geotiff. I've experimented with the gdal and Numpy libraries, but I haven't made much progress on my own. Can somebody send me some example code? Thanks, Greg Gregory Fiske Research Associate GIS and Remote Sensing Laboratory The Woods Hole Research Center 149 Woods Hole Road Falmouth, Massachusetts 02540 508-540-9900 http://www.whrc.org gfiske at whrc.org From gfiske at whrc.org Wed Feb 13 22:28:14 2008 From: gfiske at whrc.org (Greg Fiske) Date: Wed, 13 Feb 2008 16:28:14 -0500 Subject: [Image-SIG] image math Message-ID: <003201c86e87$5d47b540$17d71fc0$@org> Greetings, I'm a new python user, so pardon my simple question. I'd like to do some simple raster math within Python. For example, I'd like to read in 2 Geotiffs and add one to the other -- creating a new output Geotiff. I've experimented with the gdal and Numpy libraries, but I haven't made much progress on my own. Can somebody send me some example code? Thanks, Greg Gregory Fiske Research Associate GIS and Remote Sensing Laboratory The Woods Hole Research Center 149 Woods Hole Road Falmouth, Massachusetts 02540 508-540-9900 http://www.whrc.org gfiske at whrc.org From yuriy.sazonets at gmail.com Thu Feb 14 15:04:44 2008 From: yuriy.sazonets at gmail.com (Yuriy Sazonets) Date: Thu, 14 Feb 2008 16:04:44 +0200 Subject: [Image-SIG] GIF Problem: image gets loaded black Message-ID: <1ac9e0120802140604s12c00070o4e04ff091d1556a4@mail.gmail.com> Hi, I'm having problem with opening this image: http://sazonets.kiev.ua/843_ful070060_FLP_00_l.gif In [6]: i=Image.open('843_ful070060_FLP_00_l.gif') In [7]: i.getcolors() Out[7]: [(244290, 0)] The image opens OK in any viewer I have in my OS X. Mac OS X 10.4.11 Darwin Kernel Version 8.11.1 Python 2.5.1 (r251:54863, Nov 19 2007, 13:30:10) PIL installed using fink: pil-py25 1.1.6-1 The same problem appears on a Linux machine. Is it corrupted GIF image file (it's weird that it opens fine in other viewers) or is it a bug in PIL GIF decoder? -- With Respect, Yuriy. From fredrik at pythonware.com Thu Feb 14 21:04:24 2008 From: fredrik at pythonware.com (Fredrik Lundh) Date: Thu, 14 Feb 2008 21:04:24 +0100 Subject: [Image-SIG] installing problem pls help me In-Reply-To: <910313af0802120310o5eb1ab32g18788a24d2efad03@mail.gmail.com> References: <910313af0802120310o5eb1ab32g18788a24d2efad03@mail.gmail.com> Message-ID: bharath venkatesh wrote: > I was very much excited when i saw pil(python imaging library) as i > require it for my project ..i successfully downloaded PIL 1.1.6 source > kit(all platforms) from the site > http://www.pythonware.com/products/pil/ as i am using ubuntu linux os > and python 2.5.1 interpreter.. > > then i did the following steps mentioned in readme filei.e > > $ cd Python-2.4/Extensions # example > $ gunzip Imaging-1.1.6.tar.gz > $ tar xvf Imaging-1.1.6.tar > $ cd Imaging-1.1.6 > $ python setup.py build_ext -i > > but i am gettting the following errors as shown below i am not able to > figure out ... and i should hurry up with my project so some one pls > help me .error message is shown below googling for the very first error message you get > _imaging.c:76:20: error: Python.h: No such file or directory would have told you that you need to install the python-devel package to be able to build Python extensions. but since you're using ubuntu, you might as well skip the build step and install the python-imaging package: http://packages.ubuntu.com/edgy/python/python-imaging From Chris.Barker at noaa.gov Thu Feb 14 21:09:28 2008 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Thu, 14 Feb 2008 12:09:28 -0800 Subject: [Image-SIG] image math In-Reply-To: <003001c86e84$735d9370$5a18ba50$@org> References: <003001c86e84$735d9370$5a18ba50$@org> Message-ID: <47B49FF8.2010703@noaa.gov> Greg Fiske wrote: > I'm a new python user, so pardon my simple question. I'd like to > do some simple raster math within Python. For example, I'd like > to read in 2 Geotiffs and add one to the other -- creating a new > output Geotiff. I've experimented with the gdal and Numpy > libraries, but I haven't made much progress on my own. If you're working with geotiffs, then you're right, numpy and GDAL are the way to go. I'd send this note to GDAL list. If your math gets more complicated, then the numpy list will be helpful. You should be able to find a set of samples written in python called "python samples". Also, some of the utilities that come with GDAL are written in python -- they are a good place to start. -CHB -- 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 fredrik at pythonware.com Thu Feb 14 21:10:02 2008 From: fredrik at pythonware.com (Fredrik Lundh) Date: Thu, 14 Feb 2008 21:10:02 +0100 Subject: [Image-SIG] image caching using pil In-Reply-To: <910313af0802122256l73ff08d3w9ddd62e3ef9281ec@mail.gmail.com> References: <910313af0802122256l73ff08d3w9ddd62e3ef9281ec@mail.gmail.com> Message-ID: bharath venkatesh wrote: > is it possible to cache image , access the image from the cache , > modify the image and store it back in the cache with out having to > store the image in disk using pil.. if so let me know how to do it . > otherwise please suggest a alternative ... assuming "image" means an image stored in an image interchange format (e.g. JPEG or PNG etc), use PIL together with the StringIO module: from PIL import Image from StringIO import StringIO data = "... png data ..." im = Image.open(StringIO(data)) out = StringIO() im.save(out, format="PNG") data = out.getvalue() From bharathv6 at gmail.com Wed Feb 13 12:12:33 2008 From: bharathv6 at gmail.com (bharath venkatesh) Date: Wed, 13 Feb 2008 16:42:33 +0530 Subject: [Image-SIG] modifying images in memory Message-ID: <910313af0802130312u19cb46d5h7a0a90abd3a07fec@mail.gmail.com> i need to do is modify the image in memory like resizing the image in memory etc ... with out saving it disk as i have to return back the image with out saving it disk PIL supports the use of StringIO objects being passed in place of file objects. StringIO objects are binary strings of variable length that are kept in memory so i saved the image in stringio objects the following code does that file = StringIO() image.save(file, "JPEG") cached_image = file.getvalue() but i can't apply resize operation on cached_image as it a str object but i found out that Image.formstring(mode, size, data, decoder, parameters) Creates an image memory from pixel data in a string so i did the following image=Image.fromstring('P',(128,128),cached_image,'gif') but the i got following error shown below can any one tell me what was the error .. or tell me an alternative to modify the image in memory with out saving in disk .. Traceback (most recent call last): File "", line 1, in File "/usr/lib/python2.5/site-packages/PIL/Image.py", line 1744, in fromstring im.fromstring(data, decoder_name, args) File "/usr/lib/python2.5/site-packages/PIL/Image.py", line 577, in fromstring raise ValueError("cannot decode image data") ValueError: cannot decode image data -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20080213/431eb343/attachment-0001.htm From HAWRYLA at novachem.com Wed Feb 13 16:54:26 2008 From: HAWRYLA at novachem.com (Andrew Hawryluk) Date: Wed, 13 Feb 2008 08:54:26 -0700 Subject: [Image-SIG] installing problem pls help me In-Reply-To: <910313af0802120310o5eb1ab32g18788a24d2efad03@mail.gmail.com> Message-ID: <48C01AE7354EC240A26F19CEB995E943016934C8@CHMAILMBX01.novachem.com> PIL is also available in the Ubuntu package repository as python-imaging. Have you tried installing that one? (Either through the synaptic package manager or using 'sudo apt ...' from the command line) -Andrew -----Original Message----- From: image-sig-bounces at python.org [mailto:image-sig-bounces at python.org]On Behalf Of bharath venkatesh Sent: 12 Feb 2008 4:11 AM To: image-sig at python.org Subject: [Image-SIG] installing problem pls help me hi I was very much excited when i saw pil(python imaging library) as i require it for my project ..i successfully downloaded PIL 1.1.6 source kit(all platforms) from the site http://www.pythonware.com/products/pil/ as i am using ubuntu linux os and python 2.5.1 interpreter.. then i did the following steps mentioned in readme filei.e $ cd Python-2.4/Extensions # example $ gunzip Imaging-1.1.6.tar.gz $ tar xvf Imaging-1.1.6.tar $ cd Imaging-1.1.6 $ python setup.py build_ext -i but i am gettting the following errors as shown below i am not able to figure out ... and i should hurry up with my project so some one pls help me .error message is shown below running build_ext building '_imaging' extension gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O2 -Wall -Wstrict-prototypes -fPIC -IlibImaging -I/usr/include -I/usr/local/include -I/usr/include/python2.5 -c _imaging.c -o build/temp.linux-i686-2.5/_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 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20080213/005fbfe5/attachment-0001.htm From bharathv6 at gmail.com Thu Feb 14 07:22:46 2008 From: bharathv6 at gmail.com (bharath venkatesh) Date: Thu, 14 Feb 2008 11:52:46 +0530 Subject: [Image-SIG] parameters for Image.fromstring function in pil Message-ID: <910313af0802132222n346d2b30wf9b1be3a8c7e0647@mail.gmail.com> hi i need to do is modify the image in memory like resizing the image in memory etc ... with out saving it disk as i have to return back the image with out saving it disk PIL supports the use of StringIO objects being passed in place of file objects. StringIO objects are binary strings of variable length that are kept in memory so i saved the image in stringio objects the following code does that *for gif image** * import Image import StringIO im = Image.open("/home/bharath/Desktop/photos/lena.gif") fil=StringIO.StringIO() im.save(fil,"GIF") cached_image=fil.getvalue() or *for jpeg image* import Image import StringIO im = Image.open("/home/bharath/Desktop/photos/lena.jpg") fil=StringIO.StringIO() im.save(fil,"JPEG") cached_image=fil.getvalue() but i can't apply resize operation on cached_image as it a str object but i found out that Image.formstring(mode, size, data, decoder, parameters) Creates an image memory from pixel data in a string so i did the following *for gif image *ima=Image.fromstring('P',(128,128),cached_image,'gif') imr=ima.resize((64,64),Image.ANTIALIAS) imr.save("/home/bharath/Desktop/photos/resize_lena3.gif","GIF") * *i am getting the following error Traceback (most recent call last): File "", line 1, in File "/home/bharath/Desktop/image.py", line 8, in ima=Image.fromstring('P',(128,128),cached_image,'gif') File "/usr/lib/python2.5/site-packages/PIL/Image.py", line 1744, in fromstring im.fromstring(data, decoder_name, args) File "/usr/lib/python2.5/site-packages/PIL/Image.py", line 577, in fromstring raise ValueError("cannot decode image data") ValueError: cannot decode image data *for jpeg image * ma=Image.fromstring('P',(128,128),cached_image,'jpeg') imr=ima.resize((64,64),Image.ANTIALIAS) imr.save("/home/bharath/Desktop/photos/resize_lena3.gif","JPEG") i am getting the following error ... Traceback (most recent call last): File "", line 1, in File "/home/bharath/Desktop/image.py", line 8, in ima=Image.fromstring('RGB',(128,128),cached_image,'jpeg') File "/usr/lib/python2.5/site-packages/PIL/Image.py", line 1744, in fromstring im.fromstring(data, decoder_name, args) File "/usr/lib/python2.5/site-packages/PIL/Image.py", line 570, in fromstring d = _getdecoder(self.mode, decoder_name, args) File "/usr/lib/python2.5/site-packages/PIL/Image.py", line 373, in _getdecoder return apply(decoder, (mode,) + args + extra) TypeError: function takes at least 3 arguments (1 given) but if i remove the 4th parameter that is decoder_name i.e 'gif' or 'jpeg' in function Image.formstring(mode, size, data, decoder, parameters) there is no error(when decoder_name is not given it defaults to raw image type) .. image even gets resized and gets saved but that image is distorted image that shows that it is not decoded in correct way .. and when i want a image to be decoded according to a format i.e gif or jpeg i think i need to pass a extra parameter in the function Image.fromstring(mode, size, data, decoder, parameters) along with a decoder name to be decoded correctly . pls can any one tell me what extra parameters i have to pass with an example (taking my example itself ) -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20080214/c537b6cd/attachment.htm From bnuttall at uky.edu Thu Feb 14 23:21:54 2008 From: bnuttall at uky.edu (Nuttall, Brandon C) Date: Thu, 14 Feb 2008 17:21:54 -0500 Subject: [Image-SIG] Newbie, questions on saving PNG Message-ID: Hello, I want to do some batch conversions of uncompressed, raw tif images to optimally compressed PNG images. The documentation in Python Imaging Library Overview gets me pretty far; I think the conversion is pretty straightforward: >>> import Image >>> infile = r'c:\images\test.txt' # this is a text file of input tif image file and path names >>> inf = file(infile,'r') >>> for fn in inf: >>> fn = fn.strip() # get rid of the \n >>> print fn >>> newfn, ft = fn.rsplit('.') >>> newfn = newfn + ".png" >>> im = Image.open(fn) >>> print fn >>> print im.format, im.size, im.mode >>> print "New: ",newfn,"\n" >>> outim = im.transpose(Image.ROTATE_180) >>> outim.save(newfn,"PNG") #works, but just gets a PNG encoded image >>> inf.close() My question is how to specify the PNG optimize parameter? The documentation for the save method says Im.save(outfile,format,options) The PNG section of the documentation says "optimize" can be specified for the save method. It appears that this is the value of a keyword argument. However, if I try im.save(outfile,format,"optimize"), the code fails with a wrong number of arguments message. In the save method in Image.py, the keyword parameters passed get put into self.encoderinfo which is interrogated in the _save method in PngImagePlugin.py. So "optimize" is a key in a dictionary data structure, but a key to what and I'm lost at that point. Thanks. Brandon Nuttall -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20080214/a32fca12/attachment.htm From l.mastrodomenico at gmail.com Sat Feb 16 00:52:33 2008 From: l.mastrodomenico at gmail.com (Lino Mastrodomenico) Date: Sat, 16 Feb 2008 00:52:33 +0100 Subject: [Image-SIG] Newbie, questions on saving PNG In-Reply-To: References: Message-ID: 2008/2/14, Nuttall, Brandon C : > My question is how to specify the PNG optimize parameter? The documentation > for the save method says > > Im.save(outfile,format,options) > > The PNG section of the documentation says "optimize" can be specified for > the save method. It appears that this is the value of a keyword argument. > However, if I try im.save(outfile,format,"optimize"), the code fails with a > wrong number of arguments message. Try something like this: im.save(outfile, 'png', optimize=True) Or, if outfile ends with ".png", you can simply use: im.save(outfile, optimize=True) Hope this helps. -- Lino Mastrodomenico E-mail: l.mastrodomenico at gmail.com From fredrik at pythonware.com Sat Feb 16 09:24:43 2008 From: fredrik at pythonware.com (Fredrik Lundh) Date: Sat, 16 Feb 2008 09:24:43 +0100 Subject: [Image-SIG] parameters for Image.fromstring function in pil In-Reply-To: <910313af0802132222n346d2b30wf9b1be3a8c7e0647@mail.gmail.com> References: <910313af0802132222n346d2b30wf9b1be3a8c7e0647@mail.gmail.com> Message-ID: bharath venkatesh wrote: > but i can't apply resize operation on cached_image as it a str object > but i found out that Image.formstring(mode, size, data, decoder, > parameters) Creates an image memory from pixel data in a string so i did > the following raw pixel data and data in image interchange formats are two different things. in your case, you should use StringIO on the way in: im = Image.open(StringIO(data)) From frederic.mantegazza at gbiloba.org Sat Feb 16 15:06:11 2008 From: frederic.mantegazza at gbiloba.org (=?iso-8859-15?q?Fr=E9d=E9ric_Mantegazza?=) Date: Sat, 16 Feb 2008 15:06:11 +0100 Subject: [Image-SIG] Littlecms PIL module In-Reply-To: References: Message-ID: <200802161506.12055.frederic.mantegazza@gbiloba.org> Hello! I was looking for a littlcms python binding to make conversions between color spaces. This python binding already exists in littlecms, but it is not possible to convert entire images; as Marti explained, the goal is only to make numerical computations (one pixel at a time). As I was thinking to use PIL, Kent (from littlecms list) pointed me to an old (2002) discussion on the image-sig list, where Kevin Cazabon said he wrote a PIL module based on lcms. Unfortunally, this module does not seems to be maintained, and Kevin didn't answer (yet) to my e-mail. So, I looked at the code, which is simple, well written and well documented, and decided to modify it for my own use. For example, I wrote a (very simple) setup.py file to be able to compile and install the C module under linux; I also removed some functions, and added epydoc docstrings to generate nice html pages. This module seems to work fine, so it's maybe time to share it. As I didn't yet received an answer from Kevin, I won't put the code on a web site for now; just contact me if you want to try it. I said I adapted the code for my own use: I just need to make color space conversions, and maybe extract/assign profiles to images (this last part is not yet written; I have to look deeper in littlecms). Marti's python binding can do much more things (which I don't all understand, as my knowledge of color management is limited), so the goal is only to write things which does not exists. But I'm open to ideas and suggestions. Kent also pointed me to Phatch, a nice Photo Batch converter. So, my next goal is to make a Phatch action based on pyCMS, to convert images between color spaces (I'm looking for tutorial how to write actions, but it seems I have to look at existing actions code). Sorry for cross-posting, but as a first message, I though it was a good idea to warn all concerned people. Regards, P: I'll may rewrite this module in a more pythonic way, ie using objects methods rather than functions. -- Fr?d?ric http://www.gbiloba.org From spe.stani.be at gmail.com Sat Feb 16 22:06:34 2008 From: spe.stani.be at gmail.com (Stani) Date: Sat, 16 Feb 2008 22:06:34 +0100 Subject: [Image-SIG] Littlecms PIL module In-Reply-To: <200802161506.12055.frederic.mantegazza@gbiloba.org> References: <200802161506.12055.frederic.mantegazza@gbiloba.org> Message-ID: <47B7505A.1000809@gmail.com> Fr?d?ric Mantegazza wrote: > Hello! > > I was looking for a littlcms python binding to make conversions between > color spaces. This python binding already exists in littlecms, but it is > not possible to convert entire images; as Marti explained, the goal is > only to make numerical computations (one pixel at a time). > > As I was thinking to use PIL, Kent (from littlecms list) pointed me to > an old (2002) discussion on the image-sig list, where Kevin Cazabon said > he wrote a PIL module based on lcms. Unfortunally, this module does not > seems to be maintained, and Kevin didn't answer (yet) to my e-mail. > > So, I looked at the code, which is simple, well written and well > documented, and decided to modify it for my own use. For example, I wrote > a (very simple) setup.py file to be able to compile and install the C > module under linux; I also removed some functions, and added epydoc > docstrings to generate nice html pages. > > This module seems to work fine, so it's maybe time to share it. As I didn't > yet received an answer from Kevin, I won't put the code on a web site for > now; just contact me if you want to try it. > > I said I adapted the code for my own use: I just need to make color space > conversions, and maybe extract/assign profiles to images (this last part > is not yet written; I have to look deeper in littlecms). Marti's python > binding can do much more things (which I don't all understand, as my > knowledge of color management is limited), so the goal is only to write > things which does not exists. But I'm open to ideas and suggestions. > > Kent also pointed me to Phatch, a nice Photo Batch converter. So, my next > goal is to make a Phatch action based on pyCMS, to convert images between > color spaces (I'm looking for tutorial how to write actions, but it seems > I have to look at existing actions code). > Hi Fr?d?ric, Phatch (PHoto bATCH processor & renamer) is in a way PIL exposed through a cross-platform, user friendly GUI. It is comparable with imagemagic, but comes with an optional GUI to make complex scripts easier and better support to handle (sub)directories out of the box. It is part of Debian unstable and Ubuntu Hardy (universe), but also supports Windows and Mac. More info here: http://photobatch.stani.be To answer your question: writing actions for Phatch is very simple. Just write a PIL function with this interface: def pil(image, **keyw): #manipulate image return image Afterwards you write an interface in a similar way like you would do in Django for the keyw. Maybe a real world example is more useful, such as the common colours action: #1 from core import models from core.translation import _t #2 def init(): global Image, ImageFilter import Image, ImageFilter #3 def common(image,radius,amount=100): """Apply a filter - amount: 0-1""" commoned = image.filter(ImageFilter.ModeFilter(radius)) if amount < 100: return Image.blend(image, commoned, amount/100.0) return commoned #4 class Action(models.Action): label = _t('Common') author = 'Stani' email = 'spe.stani.be at gmail.com' init = staticmethod(init) pil = staticmethod(common) version = '0.1' tags = [_t('filter')] __doc__ = _t("Copies the most common pixel value") def interface(self,fields): fields[_t('Radius')] = self.RankSizeField(self.RANK_SIZES[0]) fields[_t('Amount')] = self.SliderField(100,1,100) So it only takes four steps to write a Phatch action: #1 Import standard Phatch functionality (always the same two lines). #2 Group all other imports in an init function. #3 Write your PIL function #4 Wrap your PIL function in a Phatch Action class. It contains some obvious information, such as author, etc... There are two important things here: 1. You need to specify your pil function as a static method to your Action class 2. You need to write the interface. As Phatch is multilingual, you need to wrap the labels with _t(). Phatch has just like Django a complete range of fields. These are some other possible fields (there are more, see phatch/core/lib/formField.py): fields[_t('Boolean')] = self.BooleanField(True) fields[_t('String')] = self.CharField('hello world') fields[_t('Choice')] = self.ChoiceField(CHOICES[0], CHOICES) fields[_t('Colour')] = self.ColourField('#FFFFFF') fields[_t('Resolution')]= self.DpiField('') fields[_t('File')] = self.FileField('/home/images/logo.jpg') fields[_t('Filename')] = self.FileNameField('') fields[_t('In')] = self.FilePathField('') #folder fields[_t('Float')] = self.FloatField(3.14) fields[_t('As')] = self.ImageTypeField('')#png, jpg fields[_t('As')] = self.ImageReadTypeField('')#png, jpg fields[_t('As')] = self.ImageWriteTypeField('')#png, jpg fields[_t('Mode')] = self.ImageModeField('')#png, jpg fields[_t('Resample')] = self.ImageResampleField(_t('bicubic')) fields[_t('Integer')] = self.IntegerField(-4) fields[_t('Integer+')] = self.PositiveIntegerField(0) fields[_t('Integer+0')] = self.PositiveNoneZeroIntegerField(0) fields[_t('Horizontal')]= self.PixelField('5%') #accepts %,cm, inch fields[_t('Slider')] = self.SliderField(60,1,100) The fields do behind the scenes different things like: - validate the input - interpolate or render image specific variables (such as , , , , but also EXIF and IPTC) during the process - automagically create the GUI if Phatch is run as a GUI application (Phatch can also run as a console application on image servers.) I hope this get you started. Actually I would be more than willing to help you to wrap your PIL function into a Phatch action, if you can document it to make the process for other people easier. I really would like to have this functionality in Phatch and I know already some professionals eager to test it. Best regards, Stani -- http://pythonide.stani.be From frederic.mantegazza at gbiloba.org Sun Feb 17 08:55:29 2008 From: frederic.mantegazza at gbiloba.org (=?iso-8859-15?q?Fr=E9d=E9ric_Mantegazza?=) Date: Sun, 17 Feb 2008 08:55:29 +0100 Subject: [Image-SIG] Littlecms PIL module In-Reply-To: <47B7505A.1000809@gmail.com> References: <200802161506.12055.frederic.mantegazza@gbiloba.org> <47B7505A.1000809@gmail.com> Message-ID: <200802170855.30376.frederic.mantegazza@gbiloba.org> On samedi 16 f?vrier 2008, Stani wrote: > Phatch (PHoto bATCH processor & renamer) is in a way PIL exposed through > a cross-platform, user friendly GUI. It is comparable with imagemagic, > but comes with an optional GUI to make complex scripts easier and better > support to handle (sub)directories out of the box. It is part of Debian > unstable and Ubuntu Hardy (universe), but also supports Windows and Mac. > More info here: > http://photobatch.stani.be > [...] Thanks! Lets continue this discussion on Phatch wiki (I saw your answer, and I'll make more tests)... -- Fr?d?ric http://www.gbiloba.org From kappamonagare at yahoo.co.jp Sun Feb 17 12:30:11 2008 From: kappamonagare at yahoo.co.jp (Fabrice C.) Date: Sun, 17 Feb 2008 20:30:11 +0900 Subject: [Image-SIG] Littlecms PIL module In-Reply-To: References: Message-ID: <47B81AC3.2030706@yahoo.co.jp> Hello Frederic, I have been using Kevin Cazabon's module for the last couple of years and it works really nice. I thought exactly the same thing when I saw that this Phatch program from Stani was out and downloaded it but did not find time to play with it yet. If you need to, and if there is anything I could help with, I would be glad to work along you on this project. CMS is very underdevelopped in free software comunity (we are lacking a good image viewer with color management abilities and even Firefox is not color managed which means that all pictures are displayed as sRGB). Fabrice C. From spe.stani.be at gmail.com Sun Feb 17 12:53:44 2008 From: spe.stani.be at gmail.com (Stani) Date: Sun, 17 Feb 2008 12:53:44 +0100 Subject: [Image-SIG] Littlecms PIL module In-Reply-To: <47B81AC3.2030706@yahoo.co.jp> References: <47B81AC3.2030706@yahoo.co.jp> Message-ID: <47B82048.2070105@gmail.com> Fabrice C. wrote: > Hello Frederic, > I have been using Kevin Cazabon's module for the last couple of years > and it works really nice. > I thought exactly the same thing when I saw that this Phatch program > from Stani was out and downloaded it but did not find time to play with > it yet. > If you need to, and if there is anything I could help with, I would be > glad to work along you on this project. > CMS is very underdevelopped in free software comunity (we are lacking a > good image viewer with color management abilities and even Firefox is > not color managed which means that all pictures are displayed as sRGB). > > Fabrice C. > > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > Fr?deric and me are working on it now. You can follow the progress here. I expect that it will work soon: http://photobatch.wikidot.com/forum/t-41633 Stani From frederic.mantegazza at gbiloba.org Sun Feb 17 13:05:47 2008 From: frederic.mantegazza at gbiloba.org (=?iso-8859-15?q?Fr=E9d=E9ric_Mantegazza?=) Date: Sun, 17 Feb 2008 13:05:47 +0100 Subject: [Image-SIG] Littlecms PIL module In-Reply-To: <47B81AC3.2030706@yahoo.co.jp> References: <47B81AC3.2030706@yahoo.co.jp> Message-ID: <200802171305.47597.frederic.mantegazza@gbiloba.org> On dimanche 17 f?vrier 2008, Fabrice C. wrote: > I have been using Kevin Cazabon's module for the last couple of years > and it works really nice. Good to hear :o) > I thought exactly the same thing when I saw that this Phatch program > from Stani was out and downloaded it but did not find time to play with > it yet. > If you need to, and if there is anything I could help with, I would be > glad to work along you on this project. Thanks. A first cms Phatch action is on the way (see Phatch forum). > CMS is very underdevelopped in free software comunity (we are lacking a > good image viewer with color management abilities and even Firefox is > not color managed which means that all pictures are displayed as sRGB). Well, there are some free software using lcms: Gimp, krita, scribus... And AFAIK firefox 3 will be color managed ;o) For a good viewer, just compile the gqview beta version; it has a good CMS. I'm using it at our photo club. I was wondering something: how is developped PIL? Is it possible to contribute? For example, could pyCMS be included in the official release? As I said, I'm rewriting it in a more pythonic way, and will call it ImageCms... -- Fr?d?ric http://www.gbiloba.org From jmil at rice.edu Mon Feb 18 10:53:43 2008 From: jmil at rice.edu (Jordan Miller) Date: Mon, 18 Feb 2008 03:53:43 -0600 Subject: [Image-SIG] PIL and Python 3000 Message-ID: <9081ED5A-B7E1-40B7-8A55-19E43BFC9A32@rice.edu> Hello! I am very interested in learning Python for pixel-based image manipulation for scientific applications, so it looks like PIL will be ideal. As I am new to Python, and Python 3000 is going to be released this year with "many deprecated features finally removed", I am considering starting properly with Python 3.0 rather than face a code migration later on. Will PIL play nicely with Python 3.0 alpha 2 (released on December 7th, 2007)? Please reply to me individually because I am not on the mailing list. ok, thanks! Jordan From pyprog05 at gmail.com Mon Feb 18 12:20:08 2008 From: pyprog05 at gmail.com (PyProg PyProg) Date: Mon, 18 Feb 2008 12:20:08 +0100 Subject: [Image-SIG] PIL and Python 3000 In-Reply-To: <9081ED5A-B7E1-40B7-8A55-19E43BFC9A32@rice.edu> References: <9081ED5A-B7E1-40B7-8A55-19E43BFC9A32@rice.edu> Message-ID: 2008/2/18, Jordan Miller : > Hello! > > I am very interested in learning Python for pixel-based image > manipulation for scientific applications, so it looks like PIL will be > ideal. As I am new to Python, and Python 3000 is going to be released > this year with "many deprecated features finally removed", I am > considering starting properly with Python 3.0 rather than face a code > migration later on. > > Will PIL play nicely with Python 3.0 alpha 2 (released on December > 7th, 2007)? > > Please reply to me individually because I am not on the mailing list. > > ok, thanks! > > Jordan I am also interested in the answer. a+ -- http://ekd.tolosano.info From jmil at rice.edu Mon Feb 18 12:22:42 2008 From: jmil at rice.edu (Jordan Miller) Date: Mon, 18 Feb 2008 05:22:42 -0600 Subject: [Image-SIG] PIL and Python 3000 In-Reply-To: <1dc6ddb60802180314ued4df75s66cac57df7e92e0c@mail.gmail.com> References: <9081ED5A-B7E1-40B7-8A55-19E43BFC9A32@rice.edu> <1dc6ddb60802180314ued4df75s66cac57df7e92e0c@mail.gmail.com> Message-ID: <73D60778-F211-42F4-9B31-1CA0675E5FFA@rice.edu> Thanks Carlos! This is a HUGE help. I post back to the list so others can benefit from your information. Thanks again!! cheers, Jordan On Feb 18, 2008, at 5:14 AM, Carlos da Silva Santos wrote: > Dear Jordan, > > Python 3000 will break compatibility with older releases in many ways. > It is supposed that the transition from the 2.x series to the 3.x > series will take a long time. During this period, the 2.x will be > actively maintained and many features from the 3.x series will be > backported to 2.x in order to ease the transition. In addition, there > are automated tools to port code from python 2.x to python 3.x. If you > write 2.x code in a more "modern" way (for instance, using != instead > of <>) and follow some guidelines (see > http://wiki.python.org/moin/FutureProofPython) many of the deprecated > features are naturally avoided so your code will be more "py3k ready". > > Right now, very few (if any) third part libraries are ported to py3k, > so you will find yourself in a somewhat restricted environment. So I > recommend you to stick to the 2.x series for now but keep one eye on > the changes about to come in py3k. > > As you are targetting in scientific applications, you will probably be > interested in numpy/scipy/matplotlib which provide python with > matlab-like features. Take a look specially in scipy.ndimage: > http://www.scipy.org/SciPyPackages/Ndimage > > I hope this helps. > > []s > Carlos > > > On Feb 18, 2008 7:53 AM, Jordan Miller wrote: >> Hello! >> >> I am very interested in learning Python for pixel-based image >> manipulation for scientific applications, so it looks like PIL will >> be >> ideal. As I am new to Python, and Python 3000 is going to be released >> this year with "many deprecated features finally removed", I am >> considering starting properly with Python 3.0 rather than face a code >> migration later on. >> >> Will PIL play nicely with Python 3.0 alpha 2 (released on December >> 7th, 2007)? >> >> Please reply to me individually because I am not on the mailing list. >> >> ok, thanks! >> >> Jordan >> >> >> _______________________________________________ >> Image-SIG maillist - Image-SIG at python.org >> http://mail.python.org/mailman/listinfo/image-sig >> > From aleksi at sympatico.ca Mon Feb 18 16:40:48 2008 From: aleksi at sympatico.ca (Aleksi) Date: Mon, 18 Feb 2008 10:40:48 -0500 Subject: [Image-SIG] _imagingft clipping problem(?) Message-ID: Hi there. Semi-newbie question... I spent the day yesterday getting PIL to run on my OSX 10.3.9 with python 2.4. Eventually I figured out that I needed to build the _imagingft.so plugin from the freetype2 library, and then the jpeg plugins too. (Thank goodness for http://wiki.python.org/moin/MacPython/UniversalLibrariesAndExtensions !) After several builds and re-installations I eventually succeeded in procedurally rendering text through the ImageFont class. Joy followed. But the joy quickly waned when I tried to render text using one of my specially purchased display fonts. No matter what I tried the top part of the text was clipped. I toyed with altering the size in the ImageFont core code, but of course that didn't work. It seems the problem is the way _imagingft evaluates the metrics of this particular font. The reason I spent the day yesterday jumping through hoops to get this to work was to be able to procedurally render text using this particular font, only to find out that I can't. I'm hoping that someone will be able to help steer me towards a solution. I looked through the freetype2 source code for a few minutes and decided I wouldn't even know where to begin solving the problem there. Is there a workaround in PIL, or am I just out of luck until a deeper fix is made to the plugin? Thank you in advance, Aleksi From frederic.mantegazza at gbiloba.org Thu Feb 21 13:51:33 2008 From: frederic.mantegazza at gbiloba.org (=?ISO-8859-1?Q?Fr=E9d=E9ric?=) Date: Thu, 21 Feb 2008 13:51:33 +0100 (CET) Subject: [Image-SIG] ImageCms module Message-ID: Hello, I finally released a first beta version of ImageCms, a littlecms-based module for PIL based on the old pyCMS code: http://trac.gbiloba.org/ImageCms ImageCms is more object oriented, and a few minors bugs have been corrected. I also removed useless functions, but I plan to add more features. This is a first draft ;o) Feel free to send me comments/requests/bug reports. I think the image-sig list is the right place for that. Regards, -- Fr?d?ric From l.mastrodomenico at gmail.com Thu Feb 21 21:11:03 2008 From: l.mastrodomenico at gmail.com (Lino Mastrodomenico) Date: Thu, 21 Feb 2008 21:11:03 +0100 Subject: [Image-SIG] GIF Problem: image gets loaded black In-Reply-To: <1ac9e0120802140604s12c00070o4e04ff091d1556a4@mail.gmail.com> References: <1ac9e0120802140604s12c00070o4e04ff091d1556a4@mail.gmail.com> Message-ID: 2008/2/14, Yuriy Sazonets : > I'm having problem with opening this image: > > http://sazonets.kiev.ua/843_ful070060_FLP_00_l.gif > > In [6]: i=Image.open('843_ful070060_FLP_00_l.gif') > > In [7]: i.getcolors() > Out[7]: [(244290, 0)] > > The image opens OK in any viewer I have in my OS X. This image is, AFAIK, technically a valid GIF, but is somewhat unusual because it contains the request that the actual pixel data should be displaced inside the image frame with an offset of 6x6 pixels. If I execute "giftrans -L 843_ful070060_FLP_00_l.gif", I obtain: ... Image Descriptor: Image Left Position: 6 pixels Image Top Position: 6 pixels Image Width: 510 pixels Image Height: 479 pixels Local Color Table Flag: False Interlace Flag: False ... I guess most image viewers simply ignore this. Seems like a bug in PIL: IMVHO it should either ignore the position offset like other viewers or try to honor it like GIMP does. In both cases it shouldn't simply load a black image. Hope this helps. -- Lino Mastrodomenico E-mail: l.mastrodomenico at gmail.com From frederic.mantegazza at gbiloba.org Fri Feb 22 16:17:45 2008 From: frederic.mantegazza at gbiloba.org (=?ISO-8859-1?Q?Fr=E9d=E9ric?=) Date: Fri, 22 Feb 2008 16:17:45 +0100 (CET) Subject: [Image-SIG] Embedded ICC profiles Message-ID: Hello, Is there a way to read ICC tag in images, and extract embedded profiles, with PIL? If not, do you have any links explaining how to do that? Little cms is only able to read a profile from disk or from memory; so I first need to retreive this profile in the image structure. Thanks, From lists+Image_SIG at hoech.org Fri Feb 22 23:59:05 2008 From: lists+Image_SIG at hoech.org (=?ISO-8859-1?Q?Florian_H=F6ch?=) Date: Fri, 22 Feb 2008 23:59:05 +0100 Subject: [Image-SIG] Embedded ICC profiles In-Reply-To: References: Message-ID: <47BF53B9.8080807@hoech.org> Hello Fr?d?ric, first, your work on ImageCms is deeply appreciated! Regarding your question, atleast for JPEG and TIFF images I think I know a way. For JPEG, an embedded ICC profile can be accessed as im.app['APP2'] (there's some data before the actual profile data 'ICC_PROFILE\x00\x01\x01' which needs to be stripped I think) For TIFF files, the data is in im.tag[34675] I guess there might be similar ways for the other formats that support embedded profiles (PNG, PDF, any others?), but I didn't look at it thoroughly yet (will do that atleast for PNG). Regards, Florian Fr?d?ric schrieb: > Hello, > > Is there a way to read ICC tag in images, and extract embedded profiles, > with PIL? If not, do you have any links explaining how to do that? > > Little cms is only able to read a profile from disk or from memory; so I > first need to retreive this profile in the image structure. > > Thanks, > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig From lists+Image_SIG at hoech.org Sat Feb 23 01:13:00 2008 From: lists+Image_SIG at hoech.org (=?ISO-8859-1?Q?Florian_H=F6ch?=) Date: Sat, 23 Feb 2008 01:13:00 +0100 Subject: [Image-SIG] Embedded ICC profiles In-Reply-To: <47BF53B9.8080807@hoech.org> References: <47BF53B9.8080807@hoech.org> Message-ID: <47BF650C.5010103@hoech.org> Just a quick follow-up regarding PNG and reading embedded profiles with PIL in general: I looked at PIL's PngImagePlugin.py and found that support to read embedded ICC profiles was not there. So I added a method to be able to retrieve the profile: PngImagePlugin.py, line 35: import zlib PngImagePlugin.py, line 165: class PngStream(ChunkStream) ... def chunk_iCCP(self, pos, len): # ICC profile s = ImageFile._safe_read(self.fp, len) # according to PNG spec, the iCCP chunk contains: # Profile name 1-79 bytes (character string) # Null separator 1 byte (null character) # Compression method 1 byte (0) # Compressed profile n bytes (zlib with deflate compression) i = string.find(s, chr(0)) self.im_info["icc_profile"] = zlib.decompress(s[i+2:]) return s Then, the profile data can be accessed via im.info["icc_profile"] Here's the additions necessary to also have im.info["icc_profile"] entries for JPEG and TIFF: JpegImagePlugin.py, line 85 in def APP(self, marker): ... elif marker == 0xFFE2 and s[:12] == "ICC_PROFILE\0": # ICC profile self.info["icc_profile"] = s[14:] ... TiffImagePlugin.py, line 105: ICCPROFILE = 34675 TiffImagePlugin.py, line 519 in def _decoder(self, rawmode, layer): ... if self.tag.has_key(ICCPROFILE): self.info['icc_profile'] = self.tag[ICCPROFILE] ... Regards, Florian From frederic.mantegazza at gbiloba.org Sat Feb 23 09:25:05 2008 From: frederic.mantegazza at gbiloba.org (=?iso-8859-15?q?Fr=E9d=E9ric_Mantegazza?=) Date: Sat, 23 Feb 2008 09:25:05 +0100 Subject: [Image-SIG] ImageCms In-Reply-To: <200802231628.08985.G.Kloss@massey.ac.nz> References: <200802231628.08985.G.Kloss@massey.ac.nz> Message-ID: <200802230925.06200.frederic.mantegazza@gbiloba.org> On samedi 23 f?vrier 2008, Guy K. Kloss wrote: > Kia ora Fr?d?ric, Bonjour, > I've seen, that you have changed the license of the code from the LGPL > to the CeCILL license. > > What are the implications of that? How does that license compare? It > sates on the web page, that it is a GPL compatible license. But is it > more or less restrictive? What license is it more comparable with? Is it > less restrictive, like the LGPL or even an MIT/BSD license so it can be > incorporated in commercial or closed source projects? Or is it as > "protective" to the open as the GPL? CeCILL license is really close to Gnu/GPL, with same goals, but is adapated to french laws (they added some explicit art., missing in the Gnu/GPL, which makes it useless in france). It is a "protective" license, like Gnu/GPL. (note that there is another CeCILL license, the CeCILL-B, which is a BSD-like license). -- Fr?d?ric http://www.gbiloba.org From lists+Image_SIG at hoech.org Sat Feb 23 20:22:45 2008 From: lists+Image_SIG at hoech.org (=?ISO-8859-1?Q?Florian_H=F6ch?=) Date: Sat, 23 Feb 2008 20:22:45 +0100 Subject: [Image-SIG] Embedded ICC profiles In-Reply-To: <47BF53B9.8080807@hoech.org> References: <47BF53B9.8080807@hoech.org> Message-ID: <47C07285.2020200@hoech.org> Another fix for PIL 1.1.6, this time to enable ICC profile access in psd files. Changes needed in PsdImagePlugin.py (diff format): 110a111,112 > if id == 1039: # ICC profile > self.info["icc_profile"] = data Regards, Florian From frederic.mantegazza at gbiloba.org Sat Feb 23 23:58:27 2008 From: frederic.mantegazza at gbiloba.org (=?iso-8859-15?q?Fr=E9d=E9ric_Mantegazza?=) Date: Sat, 23 Feb 2008 23:58:27 +0100 Subject: [Image-SIG] Embedded ICC profiles In-Reply-To: <47C07285.2020200@hoech.org> References: <47BF53B9.8080807@hoech.org> <47C07285.2020200@hoech.org> Message-ID: <200802232358.28328.frederic.mantegazza@gbiloba.org> On samedi 23 f?vrier 2008, Florian H?ch wrote: > Another fix for PIL 1.1.6, this time to enable ICC profile access in psd > files. > > Changes needed in PsdImagePlugin.py (diff format): > 110a111,112 > > > if id == 1039: # ICC profile > > self.info["icc_profile"] = data Thank you very much for all these patches, Florian. I'll take a look at your precious informations. -- Fr?d?ric http://www.gbiloba.org From lists+Image_SIG at hoech.org Sun Feb 24 13:30:51 2008 From: lists+Image_SIG at hoech.org (=?ISO-8859-1?Q?Florian_H=F6ch?=) Date: Sun, 24 Feb 2008 13:30:51 +0100 Subject: [Image-SIG] Embedded ICC profiles - updated JPEG patch In-Reply-To: <47BF650C.5010103@hoech.org> References: <47BF53B9.8080807@hoech.org> <47BF650C.5010103@hoech.org> Message-ID: <47C1637B.9070708@hoech.org> Just noticed that the JPEG patch I suggested would not succeed in retrieving ICC profiles larger than 64K, because these would be split across multiple APP2 markers. New code: JpegImagePlugin.py 83a84,105 > elif marker == 0xFFE2 and s[:12] == "ICC_PROFILE\0": > # Since an ICC profile can be larger than the maximum size of > # a JPEG marker (64K), we need provisions to split it into > # multiple markers. The format defined by the ICC specifies > # one or more APP2 markers containing the following data: > # Identifying string ASCII "ICC_PROFILE\0" (12 bytes) > # Marker sequence number 1, 2, etc (1 byte) > # Number of markers Total of APP2's used (1 byte) > # Profile data (remainder of APP2 data) > # Decoders should use the marker sequence numbers to > # reassemble the profile, rather than assuming that the APP2 > # markers appear in the correct sequence. > if not self.info.has_key("icc_profile"): > self.icc_profile_marker_prev = "\0" > self.info["icc_profile"] = "" > icc_profile_marker_curr = s[12] > if self.icc_profile_marker_prev < icc_profile_marker_curr: > self.info["icc_profile"] += s[14:] > else: > self.info["icc_profile"] = s[14:] + \ > self.info["icc_profile"] > self.icc_profile_marker_prev = icc_profile_marker_curr Regards, Florian From sahar at cmt.co.il Thu Feb 21 07:28:31 2008 From: sahar at cmt.co.il (Sahar Vilan) Date: Thu, 21 Feb 2008 08:28:31 +0200 Subject: [Image-SIG] Array <-> Image transformations Message-ID: Array <-> Image transformations- I want to change an array (at numpy) into an image (at Image) in order to rotate the image and save it in standard image format. Can anyone advice or give me an example? Tahnks, Sahar Vilan ******************************************************************************************************* This e-mail message may contain confidential,and privileged information or data that constitute proprietary information of CMT Medical Ltd. Any review or distribution by others is strictly prohibited. If you are not the intended recipient you are hereby notified that any use of this information or data by any other person is absolutely prohibited. If you are not the intended recipient, please delete all copies. Thank You. http://www.cmt.co.il ******************************************************************************************************** ************************************************************************************ This footnote confirms that this email message has been scanned by PineApp Mail-SeCure for the presence of malicious code, vandals & computer viruses. ************************************************************************************ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20080221/f0c5aa66/attachment.htm From sahar at cmt.co.il Thu Feb 21 09:47:22 2008 From: sahar at cmt.co.il (Sahar Vilan) Date: Thu, 21 Feb 2008 10:47:22 +0200 Subject: [Image-SIG] Array to Image transformations Message-ID: Can anyone help me with transformation from numpy array to image (at PIL library)? I want to change an array (at numpy) into an image (at Image) in order to rotate the image and save it in standard image format. Tahnks, Sahar Vilan ******************************************************************************************************* This e-mail message may contain confidential,and privileged information or data that constitute proprietary information of CMT Medical Ltd. Any review or distribution by others is strictly prohibited. If you are not the intended recipient you are hereby notified that any use of this information or data by any other person is absolutely prohibited. If you are not the intended recipient, please delete all copies. Thank You. http://www.cmt.co.il ******************************************************************************************************** ************************************************************************************ This footnote confirms that this email message has been scanned by PineApp Mail-SeCure for the presence of malicious code, vandals & computer viruses. ************************************************************************************ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20080221/2759fa5f/attachment.htm From derobill at yahoo.fr Thu Feb 21 15:17:37 2008 From: derobill at yahoo.fr (derobill Q.) Date: Thu, 21 Feb 2008 14:17:37 +0000 (GMT) Subject: [Image-SIG] library for image processing in 3D Message-ID: <969993.6240.qm@web27306.mail.ukl.yahoo.com> Dear All, I am a newby in Python and image processing programming environment in general. I don t know if this is the right mailing list for it. I would like to ask your advices to set up a good python environment for image processing on 3D data image (from microscopy). This project concerns 3D segmentation which need algorithms to filter the 3d data image (like 3D median filter or anisotropic diffusion filter), to slice the 3d volume in all the direction (cut plan). Maybe growing algorithms late in the project. A scriptible visualization tool or library where I can see the 3D data and the result of the segmentation which is a meta-data (.VRML format typically). I checked for Mayavi2, but I get some problem to install it on windows with the enthought eggs. Our data image format is typically .raw or .mrc. Are library already available to import those? Thanks for any impulse which could help me to see clearer in what is already available and what to do. Quentin _____________________________________________________________________________ Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail http://mail.yahoo.fr -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20080221/71f1bc7c/attachment.htm From ari at lib.aero Sun Feb 24 09:27:21 2008 From: ari at lib.aero (Ari Krupnik) Date: Sun, 24 Feb 2008 00:27:21 -0800 Subject: [Image-SIG] Converting from RGB to predefined palette Message-ID: <863arikbdi.fsf@deb.lib.aero> I have an RGB image. Can I use PIL to reduce the colors in it to those in a custom palette? I can see how to reduce colors to black and white (mode="1"), to the WEB palette or to an adaptive palette with a given number of colors. Can I use an arbitrary, non-adaptive palette? GIMP lets me use a "custom palette" when converting to indexed mode. Can I do the same with PIL? Ari. -- Elections only count as free and trials as fair if you can lose money betting on the outcome. From Chris.Barker at noaa.gov Mon Feb 25 18:22:35 2008 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Mon, 25 Feb 2008 09:22:35 -0800 Subject: [Image-SIG] library for image processing in 3D In-Reply-To: <969993.6240.qm@web27306.mail.ukl.yahoo.com> References: <969993.6240.qm@web27306.mail.ukl.yahoo.com> Message-ID: <47C2F95B.1000109@noaa.gov> derobill Q. wrote: > This project concerns 3D segmentation which need algorithms to filter > the 3d data image (like 3D median filter or anisotropic diffusion > filter), to slice the 3d volume in all the direction (cut plan). Maybe > growing algorithms late in the project. A scriptible visualization tool > or library where I can see the 3D data and the result of the > segmentation which is a meta-data (.VRML format typically). I checked > for Mayavi2, but I get some problem to install it on windows with the > enthought eggs. This really looks like a job for Mayavi, (or VTK, which Mayavi is built on) -- I'd try hard to sort our your install issues. -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 wbsmith at gmail.com Mon Feb 25 19:03:29 2008 From: wbsmith at gmail.com (W. Bryan Smith) Date: Mon, 25 Feb 2008 10:03:29 -0800 Subject: [Image-SIG] library for image processing in 3D In-Reply-To: <47C2F95B.1000109@noaa.gov> References: <969993.6240.qm@web27306.mail.ukl.yahoo.com> <47C2F95B.1000109@noaa.gov> Message-ID: here is a package that may be useful for you: http://www.na-mic.org/Wiki/index.php/Slicer3 this is intended for medical image processing, but may work for your purposes. there is a python interface... check the documentation for that (http://na-mic.org/Wiki/index.php/Slicer3::Python) regards, bryan On Mon, Feb 25, 2008 at 9:22 AM, Christopher Barker wrote: > derobill Q. wrote: > > This project concerns 3D segmentation which need algorithms to filter > > the 3d data image (like 3D median filter or anisotropic diffusion > > filter), to slice the 3d volume in all the direction (cut plan). Maybe > > growing algorithms late in the project. A scriptible visualization tool > > or library where I can see the 3D data and the result of the > > segmentation which is a meta-data (.VRML format typically). I checked > > for Mayavi2, but I get some problem to install it on windows with the > > enthought eggs. > > This really looks like a job for Mayavi, (or VTK, which Mayavi is built > on) -- I'd try hard to sort our your install issues. > > -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 > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > From shabda.raaj at gmail.com Tue Feb 26 14:17:58 2008 From: shabda.raaj at gmail.com (Shabda Raaj) Date: Tue, 26 Feb 2008 18:47:58 +0530 Subject: [Image-SIG] How to convert an Image in RGB to JPG Message-ID: <4e8b75a40802260517m449c067bq2d3572f39e2a4a6f@mail.gmail.com> This is the code I am trying and errors I get, >>> image = Image.new(mode='RGB', size = (10, 10)) >>> image.convert('JPG') Traceback (most recent call last): File "", line 1, in ? File "C:\Python24\Lib\site-packages\PIL\Image.py", line 612, in convert im = im.convert(mode, dither) ValueError: conversion from RGB to JPG not supported >>> image.convert('jpg') Traceback (most recent call last): File "", line 1, in ? File "C:\Python24\Lib\site-packages\PIL\Image.py", line 612, in convert im = im.convert(mode, dither) ValueError: conversion from RGB to jpg not supported >>> Basically I want to create an image, do some drawing on it and get the image as byte array. I am obviously missing some basic step, but I can't figure out what :( -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/image-sig/attachments/20080226/65d16536/attachment.htm From gwidion at mpc.com.br Tue Feb 26 14:21:11 2008 From: gwidion at mpc.com.br (Joao S. O. Bueno) Date: Tue, 26 Feb 2008 10:21:11 -0300 Subject: [Image-SIG] Array to Image transformations In-Reply-To: References: Message-ID: <200802261021.12097.gwidion@mpc.com.br> On Thu 21 Feb 2008 05:47:22 Sahar Vilan wrote: > Can anyone help me with transformation from numpy array to image (at PIL > library)? > I want to change an array (at numpy) into an image (at Image) in order to > rotate the image and save it in standard image format. > > Tahnks, > Sahar Vilan > > Hi... Sorry for the long delay. These convertions in python among data and image representation indeed require some experimentation. (In my todo list, wiht low priority, I have a python module that would seamlessly translate image data across various image handling bindings/ibraries and numerical types). Fortunatey, in this case it is rather simple: For numpy.array -> python image, you do something like: a = numpy.array ("\x0" (WIDTH * HEIGHT * 3), "B") #code to create imag data inside array # (...) i = Image.new("RGB", (WIDTH, HEIGHT)) i.fromstring(a.tostring()) i.save(filename) js -><- > > > > > *************************************************************************** >**************************** This e-mail message may contain > confidential,and privileged information or data that constitute > proprietary information of CMT Medical Ltd. Any review or distribution by > others is strictly prohibited. If you are not the intended recipient you > are hereby notified that any use of this information or data by any other > person is absolutely prohibited. If you are not the intended recipient, > please delete all copies. Thank You. http://www.cmt.co.il > *************************************************************************** >***************************** > > > > > > > > *************************************************************************** >********* This footnote confirms that this email message has been scanned by > PineApp Mail-SeCure for the presence of malicious code, vandals & computer > viruses. > *************************************************************************** >********* From frederic.mantegazza at gbiloba.org Wed Feb 27 07:23:37 2008 From: frederic.mantegazza at gbiloba.org (=?iso-8859-15?q?Fr=E9d=E9ric_Mantegazza?=) Date: Wed, 27 Feb 2008 07:23:37 +0100 Subject: [Image-SIG] Array to Image transformations In-Reply-To: <200802261021.12097.gwidion@mpc.com.br> References: <200802261021.12097.gwidion@mpc.com.br> Message-ID: <200802270723.38349.frederic.mantegazza@gbiloba.org> On mardi 26 f?vrier 2008, Joao S. O. Bueno wrote: > On Thu 21 Feb 2008 05:47:22 Sahar Vilan wrote: > > Can anyone help me with transformation from numpy array to image (at > > PIL library)? > > I want to change an array (at numpy) into an image (at Image) in order > > to rotate the image and save it in standard image format. > > Sorry for the long delay. > These convertions in python among data and image representation indeed > require some experimentation. > > (In my todo list, wiht low priority, I have a python module that would > seamlessly translate image data across various image handling > bindings/ibraries and numerical types). > > Fortunatey, in this case it is rather simple: > > For numpy.array -> python image, you do something like: > > a = numpy.array ("\x0" (WIDTH * HEIGHT * 3), "B") > #code to create imag data inside array > # (...) > i = Image.new("RGB", (WIDTH, HEIGHT)) > > i.fromstring(a.tostring()) > i.save(filename) Hello, I'm also very interested by such features, because I think it could be a nice way to use color management libraries. For example, the little cms python wrapper could handle arrays (which it does not yet), and then, PIL could convert image from/to arrays. > i.fromstring(a.tostring()) What is the performances of such transformations? -- Fr?d?ric http://www.gbiloba.org From frederic.mantegazza at gbiloba.org Wed Feb 27 07:28:18 2008 From: frederic.mantegazza at gbiloba.org (=?iso-8859-15?q?Fr=E9d=E9ric_Mantegazza?=) Date: Wed, 27 Feb 2008 07:28:18 +0100 Subject: [Image-SIG] How to convert an Image in RGB to JPG In-Reply-To: <4e8b75a40802260517m449c067bq2d3572f39e2a4a6f@mail.gmail.com> References: <4e8b75a40802260517m449c067bq2d3572f39e2a4a6f@mail.gmail.com> Message-ID: <200802270728.19096.frederic.mantegazza@gbiloba.org> On mardi 26 f?vrier 2008, Shabda Raaj wrote: > This is the code I am trying and errors I get, > > >>> image = Image.new(mode='RGB', size = (10, 10)) > >>> image.convert('JPG') > > Traceback (most recent call last): > File "", line 1, in ? > File "C:\Python24\Lib\site-packages\PIL\Image.py", line 612, in > convert im = im.convert(mode, dither) > ValueError: conversion from RGB to JPG not supported > > >>> image.convert('jpg') > > Traceback (most recent call last): > File "", line 1, in ? > File "C:\Python24\Lib\site-packages\PIL\Image.py", line 612, in > convert im = im.convert(mode, dither) > ValueError: conversion from RGB to jpg not supported > > > Basically I want to create an image, do some drawing on it and get the > image as byte array. I am obviously missing some basic step, but I > can't figure out what :( 'JPG" is not a valid mode ('RGB', 'RGBA', 'CMYK'... are). To get the image as something near array, use image.getdata() method. To save it as jpeg, just use image.save("myfile.jpg"). -- Fr?d?ric http://www.gbiloba.org From girzel at gmail.com Wed Feb 27 11:22:42 2008 From: girzel at gmail.com (Eric Abrahamsen) Date: Wed, 27 Feb 2008 18:22:42 +0800 Subject: [Image-SIG] saving an image with EXIF data Message-ID: <58045E8B-DAC8-465E-A31D-0196CA7A6964@gmail.com> I notice that when I open an image with PIL, manipulate it, and resave it, the EXIF data is lost. This can be a major pain, particularly with regards to image orientation -- is anyone aware of a way to feed exif data back in to the Image.save() method? Thanks! Eric From carlos.s.santos at gmail.com Wed Feb 27 12:12:40 2008 From: carlos.s.santos at gmail.com (Carlos da Silva Santos) Date: Wed, 27 Feb 2008 11:12:40 +0000 Subject: [Image-SIG] Array to Image transformations In-Reply-To: <200802270723.38349.frederic.mantegazza@gbiloba.org> References: <200802261021.12097.gwidion@mpc.com.br> <200802270723.38349.frederic.mantegazza@gbiloba.org> Message-ID: <1dc6ddb60802270312i4e2e6b2cx791b0a6963f30e81@mail.gmail.com> There are currently two PEPs related to this kind of problem. One is lead by Travis Oliphant of numpy and is about establishing a buffer protocol for data interchange. The second one is specifically related to passing image data between applications/toolkits. http://www.python.org/dev/peps/pep-3118/ http://www.python.org/dev/peps/pep-0368/ So I guess in the near future we will get rid of string conversions. Carlos On Wed, Feb 27, 2008 at 6:23 AM, Fr?d?ric Mantegazza wrote: > On mardi 26 f?vrier 2008, Joao S. O. Bueno wrote: > > > On Thu 21 Feb 2008 05:47:22 Sahar Vilan wrote: > > > > Can anyone help me with transformation from numpy array to image (at > > > PIL library)? > > > I want to change an array (at numpy) into an image (at Image) in order > > > to rotate the image and save it in standard image format. > > > > > Sorry for the long delay. > > These convertions in python among data and image representation indeed > > require some experimentation. > > > > (In my todo list, wiht low priority, I have a python module that would > > seamlessly translate image data across various image handling > > bindings/ibraries and numerical types). > > > > Fortunatey, in this case it is rather simple: > > > > For numpy.array -> python image, you do something like: > > > > a = numpy.array ("\x0" (WIDTH * HEIGHT * 3), "B") > > #code to create imag data inside array > > # (...) > > i = Image.new("RGB", (WIDTH, HEIGHT)) > > > > i.fromstring(a.tostring()) > > i.save(filename) > > Hello, > > I'm also very interested by such features, because I think it could be a > nice way to use color management libraries. For example, the little cms > python wrapper could handle arrays (which it does not yet), and then, PIL > could convert image from/to arrays. > > > i.fromstring(a.tostring()) > > What is the performances of such transformations? > > -- > Fr?d?ric > > http://www.gbiloba.org > > > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > From gwidion at mpc.com.br Wed Feb 27 12:29:15 2008 From: gwidion at mpc.com.br (Joao S. O. Bueno) Date: Wed, 27 Feb 2008 08:29:15 -0300 Subject: [Image-SIG] Array to Image transformations In-Reply-To: <200802270723.38349.frederic.mantegazza@gbiloba.org> References: <200802261021.12097.gwidion@mpc.com.br> <200802270723.38349.frederic.mantegazza@gbiloba.org> Message-ID: <200802270829.15531.gwidion@mpc.com.br> On Wednesday 27 February 2008, Fr?d?ric Mantegazza wrote: > On mardi 26 f?vrier 2008, Joao S. O. Bueno wrote: > > On Thu 21 Feb 2008 05:47:22 Sahar Vilan wrote: > > > Can anyone help me with transformation from numpy array to > > > image (at PIL library)? > > > I want to change an array (at numpy) into an image (at Image) > > > in order to rotate the image and save it in standard image > > > format. > > > > Sorry for the long delay. > > These convertions in python among data and image representation > > indeed require some experimentation. > > > > (In my todo list, wiht low priority, I have a python module that > > would seamlessly translate image data across various image > > handling bindings/ibraries and numerical types). > > > > Fortunatey, in this case it is rather simple: > > > > For numpy.array -> python image, you do something like: > > > > a = numpy.array ("\x0" (WIDTH * HEIGHT * 3), "B") > > #code to create imag data inside array > > # (...) > > i = Image.new("RGB", (WIDTH, HEIGHT)) > > > > i.fromstring(a.tostring()) > > i.save(filename) > > Hello, > > I'm also very interested by such features, because I think it could > be a nice way to use color management libraries. For example, the > little cms python wrapper could handle arrays (which it does not > yet), and then, PIL could convert image from/to arrays. > > > i.fromstring(a.tostring()) > > What is the performances of such transformations? Hi. I did not measure it, and just tested with a small image. I think that computing-wise this is not intensive, but I see this could need as much as twice the image size in RAM - one for copying the array data to a string, and another to copy the same data again to a PIL image. It maybe however that pynum.tostring points to the same data in system memory, so you just need to have memory for the Image object to be created. As for CPU performance - this should be fast, as it is simply copying data around, and both numpy and PIL should do it the fastest possible way. Before finding out both to/from string method I made some trials with list compreensions tgo copy color components around. That was very slow, even for a 256x256 test image. js -><- From frederic.mantegazza at gbiloba.org Wed Feb 27 13:05:44 2008 From: frederic.mantegazza at gbiloba.org (=?ISO-8859-1?Q?Fr=E9d=E9ric?=) Date: Wed, 27 Feb 2008 13:05:44 +0100 (CET) Subject: [Image-SIG] Array to Image transformations In-Reply-To: <1dc6ddb60802270312i4e2e6b2cx791b0a6963f30e81@mail.gmail.com> Message-ID: <5EUMm5Vb.1204113944.1960490.fma@alezan.org> Le 27/2/2008, "Carlos da Silva Santos" a ?crit: >There are currently two PEPs related to this kind of problem. One is >lead by Travis Oliphant of numpy and is about establishing a buffer >protocol for data interchange. The second one is specifically related >to passing image data between applications/toolkits. > >http://www.python.org/dev/peps/pep-3118/ >http://www.python.org/dev/peps/pep-0368/ > >So I guess in the near future we will get rid of string conversions. Very interesting. Thanks for the links! From Chris.Barker at noaa.gov Wed Feb 27 18:45:23 2008 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Wed, 27 Feb 2008 09:45:23 -0800 Subject: [Image-SIG] How to convert an Image in RGB to JPG In-Reply-To: <200802270728.19096.frederic.mantegazza@gbiloba.org> References: <4e8b75a40802260517m449c067bq2d3572f39e2a4a6f@mail.gmail.com> <200802270728.19096.frederic.mantegazza@gbiloba.org> Message-ID: <47C5A1B3.7080804@noaa.gov> Fr?d?ric Mantegazza wrote: > On mardi 26 f?vrier 2008, Shabda Raaj wrote: >> Basically I want to create an image, do some drawing on it and get the >> image as byte array. > 'JPG" is not a valid mode exactly. Also, jpeg is NOT a byte array it's a lossy compressed format -- RGB already is a byte array. -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 Chris.Barker at noaa.gov Wed Feb 27 18:48:09 2008 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Wed, 27 Feb 2008 09:48:09 -0800 Subject: [Image-SIG] Array to Image transformations In-Reply-To: <1dc6ddb60802270312i4e2e6b2cx791b0a6963f30e81@mail.gmail.com> References: <200802261021.12097.gwidion@mpc.com.br> <200802270723.38349.frederic.mantegazza@gbiloba.org> <1dc6ddb60802270312i4e2e6b2cx791b0a6963f30e81@mail.gmail.com> Message-ID: <47C5A259.9060302@noaa.gov> Carlos da Silva Santos wrote: > There are currently two PEPs related to this kind of problem. One is > lead by Travis Oliphant of numpy and is about establishing a buffer > protocol for data interchange. The second one is specifically related > to passing image data between applications/toolkits. > > http://www.python.org/dev/peps/pep-3118/ > http://www.python.org/dev/peps/pep-0368/ > > So I guess in the near future we will get rid of string conversions. Actually, we already have, for numpy and PIL anyway: # Added ?fromarray? function, which takes an object implementing the NumPy array interface and creates a PIL Image from it. (from Travis Oliphant). # Added NumPy array interface support (__array_interface__) to the Image class (based on code by Travis Oliphant). This allows you to easily convert between PIL image memories and NumPy arrays: import numpy, Image i = Image.open('lena.jpg') a = numpy.asarray(i) # a is readonly i = Image.fromarray(a) See: http://effbot.org/zone/pil-changes-116.htm No data copying at all! -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 frederic.mantegazza at gbiloba.org Wed Feb 27 20:42:04 2008 From: frederic.mantegazza at gbiloba.org (=?utf-8?q?Fr=C3=A9d=C3=A9ric_Mantegazza?=) Date: Wed, 27 Feb 2008 20:42:04 +0100 Subject: [Image-SIG] Array to Image transformations In-Reply-To: <47C5A259.9060302@noaa.gov> References: <1dc6ddb60802270312i4e2e6b2cx791b0a6963f30e81@mail.gmail.com> <47C5A259.9060302@noaa.gov> Message-ID: <200802272042.05343.frederic.mantegazza@gbiloba.org> On mercredi 27 f?vrier 2008, Christopher Barker wrote: > Actually, we already have, for numpy and PIL anyway: > > > # Added ?fromarray? function, which takes an object implementing the > NumPy array interface and creates a PIL Image from it. (from Travis > Oliphant). > > # Added NumPy array interface support (__array_interface__) to the Image > class (based on code by Travis Oliphant). This allows you to easily > convert between PIL image memories and NumPy arrays: > > import numpy, Image > > i = Image.open('lena.jpg') > a = numpy.asarray(i) # a is readonly > i = Image.fromarray(a) > > See: > > http://effbot.org/zone/pil-changes-116.htm > > No data copying at all! Great! I was using the on-line documentation, which only covers 1.1.5... I'll have a look at the 1.1.6 doc. -- Fr?d?ric http://www.gbiloba.org From G.Kloss at massey.ac.nz Wed Feb 27 23:40:39 2008 From: G.Kloss at massey.ac.nz (Guy K. Kloss) Date: Thu, 28 Feb 2008 11:40:39 +1300 Subject: [Image-SIG] problem with PIL's Image.save() on TIFFs Message-ID: <200802281140.43801.G.Kloss@massey.ac.nz> Hi, I've just had some problems with PIL's implementation of the Image.save() method when writing TIFF files. Apparently some internal tags on resolution are totally out of the normal. Using the TIFFs from libtiff later on produces some warning on a tag with bad information. This is what libtiff's warning handler produces: _TIFFVSetField: diag.tif: Bad value 47088 for "ResolutionUnit". diag.tif: Warning, "YResolution": Information lost writing value (-2.94176e-05) as (unsigned) RATIONAL. According to Graeme Gill's information (who implements Argyll CMS, that's using libtiff for its purposes) """ [...] According to the TIFF spec, the ResolutionUnit tag can have one of three values: (From tiff/libtiff/tiff.h) #define TIFFTAG_RESOLUTIONUNIT 296 /* units of resolutions */ #define RESUNIT_NONE 1 /* no meaningful units */ #define RESUNIT_INCH 2 /* english */ #define RESUNIT_CENTIMETER 3 /* metric */ """ It seems like the implementation in PIL.Image for save() puts a non standard value (here 47088) into the field ResolutionUnit, and there also seems to be something funny with the YResolution field in the TIFF file. To me this very much sounds like an issue with uninitialised variables in some structures, as the values tend to be different on different runs, as well as the fact that they're well out of whack indicates this. Guy -- Guy K. Kloss Institute of Information and Mathematical Sciences Te Kura Putaiao o Mohiohio me Pangarau Room 2.63, Quad Block A Building Massey University, Auckland, Albany Private Bag 102 904, North Shore Mail Centre voice: +64 9 414-0800 ext. 9585 ? fax: +64 9 441-8181 eMail: G.Kloss at massey.ac.nz ?http://www.massey.ac.nz/~gkloss/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part. Url : http://mail.python.org/pipermail/image-sig/attachments/20080228/492a85bb/attachment.pgp From fredrik at pythonware.com Thu Feb 28 19:07:40 2008 From: fredrik at pythonware.com (Fredrik Lundh) Date: Thu, 28 Feb 2008 19:07:40 +0100 Subject: [Image-SIG] problem with PIL's Image.save() on TIFFs In-Reply-To: <200802281140.43801.G.Kloss@massey.ac.nz> References: <200802281140.43801.G.Kloss@massey.ac.nz> Message-ID: Guy K. Kloss wrote: > I've just had some problems with PIL's implementation of the Image.save() > method when writing TIFF files. Apparently some internal tags on resolution > are totally out of the normal. Using the TIFFs from libtiff later on produces > some warning on a tag with bad information. > > This is what libtiff's warning handler produces: > > _TIFFVSetField: diag.tif: Bad value 47088 for "ResolutionUnit". > diag.tif: Warning, "YResolution": Information lost writing value > (-2.94176e-05) as (unsigned) RATIONAL. PIL doesn't create resolution tags by itself, so unless you add it yourself, or roundtrip an existing TIFF file, the file shouldn't contain any resolution tags at all. if the former, it would help if you could post the code you're using to set the tags. if the latter, please post the contents of im.tags.items(), just before you save the file. e.g. print im.tags.items() im.save("out.tif") > To me this very much sounds like an issue with uninitialised variables > in some structures There's really no such thing as an uninitalized variable in Python... From l.mastrodomenico at gmail.com Thu Feb 28 19:49:14 2008 From: l.mastrodomenico at gmail.com (Lino Mastrodomenico) Date: Thu, 28 Feb 2008 19:49:14 +0100 Subject: [Image-SIG] PIL can't find the native libs on AMD64 (patch included) Message-ID: Hi everyone, on my GNU/Linux AMD64 system, setup.py from PIL 1.1.6 doesn't find the native libraries for Tkinter, JPEG, ZLIB and Freetype2 support, unless I also install the 32-bit version of the libraries (I have a 64-bit Python 2.4.3). This patch seems to fix the problem for me, but I'm not sure it's always the correct one: --- setup.py.orig 2006-12-03 12:37:29.000000000 +0100 +++ setup.py 2008-02-28 19:20:46.000000000 +0100 @@ -199,6 +199,9 @@ add_directory(library_dirs, "/usr/lib") add_directory(include_dirs, "/usr/include") + if sys.arch == "x86_64": + library_dirs = [s.replace("/lib", "/lib64") for s in library_dirs] + # # insert new dirs *before* default libs, to avoid conflicts # between Python PYD stub libs and real libraries -- Lino Mastrodomenico E-mail: l.mastrodomenico at gmail.com From cblubaug at purdue.edu Thu Feb 28 23:51:55 2008 From: cblubaug at purdue.edu (Joe Blubaugh) Date: Thu, 28 Feb 2008 17:51:55 -0500 Subject: [Image-SIG] PIL Installation Issue Message-ID: <47C73B0B.1040505@purdue.edu> I am attempting to install PIL on Ubuntu 7.10. On running the in-place install, I get this output: joe at Norrell:/usr/lib/python2.5/Imaging-1.1.6$ python setup.py build_ext -i running build_ext building '_imagingft' extension gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/freetype2 -IlibImaging -I/usr/include -I/usr/lib -I/usr/include/tcl8.4/ -I/usr/local/include -I/usr/include/python2.5 -c _imagingft.c -o build/temp.linux-i686-2.5/_imagingft.o gcc -pthread -shared -Wl,-O1 build/temp.linux-i686-2.5/_imagingft.o -L/usr/local/lib -L/usr/include/tcl8.4/ -lfreetype -o PIL/_imagingft.so -------------------------------------------------------------------- PIL 1.1.6 BUILD SUMMARY -------------------------------------------------------------------- version 1.1.6 platform linux2 2.5.1 (r251:54863, Oct 5 2007, 13:36:32) [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] -------------------------------------------------------------------- --- TKINTER support ok --- JPEG support ok --- ZLIB (PNG/ZIP) support ok --- FREETYPE2 support ok -------------------------------------------------------------------- To check the build, run the selftest.py script. Which appears ok (including jpeg support). However, on running the selftest.py script, I error on one of the tests: ***************************************************************** 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 haven't been able to find a reason for this failure yet. Have you seen these kind of install issues before? Joe Blubaugh cblubaug at purdue.edu From spe.stani.be at gmail.com Fri Feb 29 00:18:54 2008 From: spe.stani.be at gmail.com (Stani) Date: Fri, 29 Feb 2008 00:18:54 +0100 Subject: [Image-SIG] PIL Installation Issue In-Reply-To: <47C73B0B.1040505@purdue.edu> References: <47C73B0B.1040505@purdue.edu> Message-ID: <2078a7ad0802281518w5f4782abqc30ff72babe247d9@mail.gmail.com> On Ubuntu you can install PIL by: sudo apt-get install python-imaging On Thu, Feb 28, 2008 at 11:51 PM, Joe Blubaugh wrote: > I am attempting to install PIL on Ubuntu 7.10. On running the in-place > install, I get this output: > > joe at Norrell:/usr/lib/python2.5/Imaging-1.1.6$ python setup.py > build_ext -i > running build_ext > building '_imagingft' extension > gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O2 -Wall > -Wstrict-prototypes -fPIC -I/usr/include/freetype2 -IlibImaging > -I/usr/include -I/usr/lib -I/usr/include/tcl8.4/ > -I/usr/local/include -I/usr/include/python2.5 -c _imagingft.c -o > build/temp.linux-i686-2.5/_imagingft.o > gcc -pthread -shared -Wl,-O1 build/temp.linux-i686-2.5/_imagingft.o > -L/usr/local/lib -L/usr/include/tcl8.4/ -lfreetype -o PIL/_imagingft.so > -------------------------------------------------------------------- > PIL 1.1.6 BUILD SUMMARY > -------------------------------------------------------------------- > version 1.1.6 > platform linux2 2.5.1 (r251:54863, Oct 5 2007, 13:36:32) > [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] > -------------------------------------------------------------------- > --- TKINTER support ok > --- JPEG support ok > --- ZLIB (PNG/ZIP) support ok > --- FREETYPE2 support ok > -------------------------------------------------------------------- > To check the build, run the selftest.py script. > > > Which appears ok (including jpeg support). However, on running the > selftest.py script, I error on one of the tests: > > ***************************************************************** > 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 haven't been able to find a reason for this failure yet. Have you seen > these kind of install issues before? > > > Joe Blubaugh > cblubaug at purdue.edu > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > -- http://pythonide.stani.be From G.Kloss at massey.ac.nz Fri Feb 29 04:02:39 2008 From: G.Kloss at massey.ac.nz (Guy K. Kloss) Date: Fri, 29 Feb 2008 16:02:39 +1300 Subject: [Image-SIG] problem with PIL's Image.save() on TIFFs In-Reply-To: References: <200802281140.43801.G.Kloss@massey.ac.nz> Message-ID: <200802291602.39516.G.Kloss@massey.ac.nz> On Fri, 29 Feb 2008 7:07:40 am Fredrik Lundh wrote: > PIL doesn't create resolution tags by itself, so unless you add it > yourself, or roundtrip an existing TIFF file, the file shouldn't contain > any resolution tags at all. > > if the former, it would help if you could post the code you're using to > set the tags. I'm not setting any tags. I'm capturing an image through OpenCV (web cam), using opencv.adaptors.Ipl2PIL() to get a PIL image. That one is just written out using myImage.save('foo.tif') > if the latter, please post the contents of im.tags.items(), just before > you save the file. ?e.g. > > ? ? ?print im.tags.items() > ? ? ?im.save("out.tif") In [6]: myImage.tag.items() Out[6]: [(256, (640,)), (257, (480,)), (258, (8, 8, 8)), (259, (1,)), (262, (2,)), (273, (128,)), (278, (480,)), (277, (3,)), (279, (921600,))] Hopefully that's enlightening to you. It surely isn't to me ... :) Unfortunately I couldn't find any documentation on the "tag" attribute at http://www.pythonware.com/library/pil/handbook/image.htm >?> To me this very much sounds like an issue with uninitialised > > variables > > in some structures > > There's really no such thing as an uninitalized variable in Python... No, but I assume that PIL is implemented in C/C++ behind the scenes, and it's accessed through a wrapper. And in C it is very well possible and a common mistake. Just look at what students here are cooking up and you know what I mean ... :-/ HTH, Guy -- Guy K. Kloss Institute of Information and Mathematical Sciences Te Kura Putaiao o Mohiohio me Pangarau Room 2.63, Quad Block A Building Massey University, Auckland, Albany Private Bag 102 904, North Shore Mail Centre voice: +64 9 414-0800 ext. 9585 ? fax: +64 9 441-8181 eMail: G.Kloss at massey.ac.nz ?http://iims.massey.ac.nz -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part. Url : http://mail.python.org/pipermail/image-sig/attachments/20080229/45a5e2af/attachment.pgp From lists+Image_SIG at hoech.org Fri Feb 29 12:21:02 2008 From: lists+Image_SIG at hoech.org (=?ISO-8859-15?Q?Florian_H=F6ch?=) Date: Fri, 29 Feb 2008 12:21:02 +0100 Subject: [Image-SIG] problem with PIL's Image.save() on TIFFs In-Reply-To: <200802281140.43801.G.Kloss@massey.ac.nz> References: <200802281140.43801.G.Kloss@massey.ac.nz> Message-ID: <47C7EA9E.4080405@hoech.org> Hello Guy, PIL 1.1.6 still seems to have a bug regarding its interpretation of TIFFTAG_RESOLUTIONUNIT, which could lead to "strange" values being written to the TIFF file. I and Gary Bloom posted fixes to the list awhile ago. For convenience, here's the diff patch for TiffImagePlugin.py again, containing both mine (reading) and Gary's (writing) fix: 577,578c577,578 < xdpi = getscalar(X_RESOLUTION, (1, 1)) < ydpi = getscalar(Y_RESOLUTION, (1, 1)) --- > xres = getscalar(X_RESOLUTION, (1, 1)) > yres = getscalar(Y_RESOLUTION, (1, 1)) 580,583c580,589 < if xdpi and ydpi and getscalar(RESOLUTION_UNIT, 1) == 1: < xdpi = xdpi[0] / (xdpi[1] or 1) < ydpi = ydpi[0] / (ydpi[1] or 1) < self.info["dpi"] = xdpi, ydpi --- > 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: # dots per inch > self.info["dpi"] = xres, yres > elif resunit == 3: # dots per centimeter. convert to dpi > self.info["dpi"] = xres * 2.54, yres * 2.54 > else: # No absolute unit of measurement. Used for images that may have a non-square aspect ratio, but no meaningful absolute dimensions. > self.info["resolution"] = xres, yres 721c727 < ifd[RESOLUTION_UNIT] = 1 --- > ifd[RESOLUTION_UNIT] = 2 To explain what the patch does: Without the fix, PIL's interpretation of RESOLUTION_UNIT is "off by one", e.g. RESOLUTION_UNIT 1 (no absolute unit of measurement) is treated as RESOLUTION_UNIT 2 (dots per inch). The patch solves this and also takes into account RESOLUTION_UNIT 3 (dots per centimeters) by converting to dots per inch and setting info["dpi"] accordingly. In the case of RESOLUTION_UNIT other than 2 or 3, there may be no meaningful resolution set in the image. After applying the patch, this case can be checked for in your code if needed with yourimage.info.has_key("dpi") and if that returns False, checking yourimage.info["resolution"]. The fix currently has the small drawback that, if RESOLUTION_UNIT was 3 (dpc) in the input image, when saving the TIFF file the resolution unit will always be dpi. Regards, Florian Guy K. Kloss schrieb: > Hi, > > I've just had some problems with PIL's implementation of the Image.save() > method when writing TIFF files. Apparently some internal tags on resolution > are totally out of the normal. Using the TIFFs from libtiff later on produces > some warning on a tag with bad information. > > This is what libtiff's warning handler produces: > > _TIFFVSetField: diag.tif: Bad value 47088 for "ResolutionUnit". > diag.tif: Warning, "YResolution": Information lost writing value > (-2.94176e-05) as (unsigned) RATIONAL. > > According to Graeme Gill's information (who implements Argyll CMS, that's > using libtiff for its purposes) > > """ > [...] According to the TIFF spec, the ResolutionUnit tag can have one of three > values: (From tiff/libtiff/tiff.h) > > #define TIFFTAG_RESOLUTIONUNIT 296 /* units of resolutions */ > #define RESUNIT_NONE 1 /* no meaningful units */ > #define RESUNIT_INCH 2 /* english */ > #define RESUNIT_CENTIMETER 3 /* metric */ > """ > > It seems like the implementation in PIL.Image for save() puts a non standard > value (here 47088) into the field ResolutionUnit, and there also seems to be > something funny with the YResolution field in the TIFF file. > > To me this very much sounds like an issue with uninitialised variables in some > structures, as the values tend to be different on different runs, as well as > the fact that they're well out of whack indicates this. > > Guy From lists+Image_SIG at hoech.org Fri Feb 29 16:28:02 2008 From: lists+Image_SIG at hoech.org (=?ISO-8859-15?Q?Florian_H=F6ch?=) Date: Fri, 29 Feb 2008 16:28:02 +0100 Subject: [Image-SIG] ImageCms feature request: support for softproofing, black point comp Message-ID: <47C82482.9070800@hoech.org> Hello Fr?d?ric, it would be great to be able to use LittleCMS flags (like for black point compensation or softproofing) in ImageCms. I have made changes to ImageCms_0.9-beta1-r15 to allow the use of these flags. I uploaded a zip archive containing the changed files, backups, and diff patches here: http://hoech.net/files/ImageCms_0.9-beta1-r15_flags_patch.zip - Florian From frederic.mantegazza at gbiloba.org Fri Feb 29 17:03:53 2008 From: frederic.mantegazza at gbiloba.org (=?ISO-8859-1?Q?Fr=E9d=E9ric?=) Date: Fri, 29 Feb 2008 17:03:53 +0100 (CET) Subject: [Image-SIG] ImageCms feature request: support for softproofing, black point comp In-Reply-To: <47C82482.9070800@hoech.org> Message-ID: Le 29/2/2008, "Florian H?ch" a ?crit: >it would be great to be able to use LittleCMS flags (like for black >point compensation or softproofing) in ImageCms. I have made changes to >ImageCms_0.9-beta1-r15 to allow the use of these flags. I uploaded a zip >archive containing the changed files, backups, and diff patches here: >http://hoech.net/files/ImageCms_0.9-beta1-r15_flags_patch.zip Thanks! I'll have a look at your patches and integrate them in svn version. From G.Kloss at massey.ac.nz Fri Feb 29 20:24:37 2008 From: G.Kloss at massey.ac.nz (Guy K. Kloss) Date: Sat, 1 Mar 2008 08:24:37 +1300 Subject: [Image-SIG] problem with PIL's Image.save() on TIFFs In-Reply-To: <47C7EA9E.4080405@hoech.org> References: <200802281140.43801.G.Kloss@massey.ac.nz> <47C7EA9E.4080405@hoech.org> Message-ID: <200803010824.42282.G.Kloss@massey.ac.nz> Thanks Florian! On Sat, 01 Mar 2008 12:21:02 am Florian H?ch wrote: > I and Gary Bloom posted fixes to the list awhile ago. For convenience, > here's the diff patch for TiffImagePlugin.py again, containing both mine > (reading) and Gary's (writing) fix: Patch is highly appreciated and mended in. Vielen Dank nochmal, Guy -- Guy K. Kloss Institute of Information and Mathematical Sciences Te Kura Putaiao o Mohiohio me Pangarau Room 2.63, Quad Block A Building Massey University, Auckland, Albany Private Bag 102 904, North Shore Mail Centre voice: +64 9 414-0800 ext. 9585 ? fax: +64 9 441-8181 eMail: G.Kloss at massey.ac.nz ?http://www.massey.ac.nz/~gkloss/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part. Url : http://mail.python.org/pipermail/image-sig/attachments/20080301/7221c68f/attachment.pgp From frederic.mantegazza at gbiloba.org Fri Feb 29 22:34:20 2008 From: frederic.mantegazza at gbiloba.org (=?iso-8859-15?q?Fr=E9d=E9ric_Mantegazza?=) Date: Fri, 29 Feb 2008 22:34:20 +0100 Subject: [Image-SIG] ImageCms feature request: support for softproofing, black point comp In-Reply-To: <47C82482.9070800@hoech.org> References: <47C82482.9070800@hoech.org> Message-ID: <200802292234.20626.frederic.mantegazza@gbiloba.org> On vendredi 29 f?vrier 2008, Florian H?ch wrote: > it would be great to be able to use LittleCMS flags (like for black > point compensation or softproofing) in ImageCms. I have made changes to > ImageCms_0.9-beta1-r15 to allow the use of these flags. I uploaded a zip > archive containing the changed files, backups, and diff patches here: > http://hoech.net/files/ImageCms_0.9-beta1-r15_flags_patch.zip Ok, I started to integrate your patch. I was wondering if we should not use a sequence for giving flags, instead of |-ing them. Something like: flags = [ImageCms.FLAGS_GAMUTCHECK, ImageCms.FLAGS_PRESERVEBLACK] The resulting value will be computed internally. This seems more pythonic... What do you thing about? -- Fr?d?ric http://www.gbiloba.org From spe.stani.be at gmail.com Fri Feb 29 12:28:32 2008 From: spe.stani.be at gmail.com (Stani) Date: Fri, 29 Feb 2008 12:28:32 +0100 Subject: [Image-SIG] problem with PIL's Image.save() on TIFFs In-Reply-To: <47C7EA9E.4080405@hoech.org> References: <200802281140.43801.G.Kloss@massey.ac.nz> <47C7EA9E.4080405@hoech.org> Message-ID: <47C7EC60.5050506@gmail.com> I can confirm that this bug exists and that this patch works. I hope it gets included in PIL 1.1.7 Stani -- http://photobatch.stani.be Florian H?ch wrote: > Hello Guy, > > PIL 1.1.6 still seems to have a bug regarding its interpretation of > TIFFTAG_RESOLUTIONUNIT, which could lead to "strange" values being > written to the TIFF file. > > I and Gary Bloom posted fixes to the list awhile ago. For convenience, > here's the diff patch for TiffImagePlugin.py again, containing both mine > (reading) and Gary's (writing) fix: > > > 577,578c577,578 > < xdpi = getscalar(X_RESOLUTION, (1, 1)) > < ydpi = getscalar(Y_RESOLUTION, (1, 1)) > --- > > xres = getscalar(X_RESOLUTION, (1, 1)) > > yres = getscalar(Y_RESOLUTION, (1, 1)) > 580,583c580,589 > < if xdpi and ydpi and getscalar(RESOLUTION_UNIT, 1) == 1: > < xdpi = xdpi[0] / (xdpi[1] or 1) > < ydpi = ydpi[0] / (ydpi[1] or 1) > < self.info["dpi"] = xdpi, ydpi > --- > > 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: # dots per inch > > self.info["dpi"] = xres, yres > > elif resunit == 3: # dots per centimeter. convert to dpi > > self.info["dpi"] = xres * 2.54, yres * 2.54 > > else: # No absolute unit of measurement. Used for images > that may > have a non-square aspect ratio, but no meaningful absolute dimensions. > > self.info["resolution"] = xres, yres > 721c727 > < ifd[RESOLUTION_UNIT] = 1 > --- > > ifd[RESOLUTION_UNIT] = 2 > > > To explain what the patch does: Without the fix, PIL's interpretation of > RESOLUTION_UNIT is "off by one", e.g. RESOLUTION_UNIT 1 (no absolute > unit of measurement) is treated as RESOLUTION_UNIT 2 (dots per inch). > The patch solves this and also takes into account RESOLUTION_UNIT 3 > (dots per centimeters) by converting to dots per inch and setting > info["dpi"] accordingly. In the case of RESOLUTION_UNIT other than 2 or > 3, there may be no meaningful resolution set in the image. After > applying the patch, this case can be checked for in your code if needed > with yourimage.info.has_key("dpi") and if that returns False, checking > yourimage.info["resolution"]. > The fix currently has the small drawback that, if RESOLUTION_UNIT was 3 > (dpc) in the input image, when saving the TIFF file the resolution unit > will always be dpi. > > Regards, > > Florian > > Guy K. Kloss schrieb: > >> Hi, >> >> I've just had some problems with PIL's implementation of the Image.save() >> method when writing TIFF files. Apparently some internal tags on resolution >> are totally out of the normal. Using the TIFFs from libtiff later on produces >> some warning on a tag with bad information. >> >> This is what libtiff's warning handler produces: >> >> _TIFFVSetField: diag.tif: Bad value 47088 for "ResolutionUnit". >> diag.tif: Warning, "YResolution": Information lost writing value >> (-2.94176e-05) as (unsigned) RATIONAL. >> >> According to Graeme Gill's information (who implements Argyll CMS, that's >> using libtiff for its purposes) >> >> """ >> [...] According to the TIFF spec, the ResolutionUnit tag can have one of three >> values: (From tiff/libtiff/tiff.h) >> >> #define TIFFTAG_RESOLUTIONUNIT 296 /* units of resolutions */ >> #define RESUNIT_NONE 1 /* no meaningful units */ >> #define RESUNIT_INCH 2 /* english */ >> #define RESUNIT_CENTIMETER 3 /* metric */ >> """ >> >> It seems like the implementation in PIL.Image for save() puts a non standard >> value (here 47088) into the field ResolutionUnit, and there also seems to be >> something funny with the YResolution field in the TIFF file. >> >> To me this very much sounds like an issue with uninitialised variables in some >> structures, as the values tend to be different on different runs, as well as >> the fact that they're well out of whack indicates this. >> >> Guy >> > _______________________________________________ > 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/20080229/f95f2774/attachment.htm