From aclark at aclark.net Wed Mar 6 15:41:08 2013 From: aclark at aclark.net (Alex Clark) Date: Wed, 6 Mar 2013 09:41:08 -0500 Subject: [Image-SIG] PSF grant References: Message-ID: On 2013-02-28 01:29:47 +0000, Alex Clark said: > On 2013-02-25 16:00:21 +0000, Alex Clark said: > >> Dear Python Imaging Folks, >> >> >> I'm considering asking the PSF for a grant to fund my work on >> Pillowfor> Python 3, please add any comments/questions/concerns you may >> havehere: >> >> >> - https://github.com/python-imaging/Pillow/issues/61 >> >> >> Thank you! > > > Proposal I will send tomorrow, comments > welcome:https://github.com/python-imaging/psf-grant-proposal Approved! Thank you PSF. Closed https://github.com/python-imaging/Pillow/issues/61. > >> >> >> Alex -- Alex Clark ? http://about.me/alex.clark From aclark at aclark.net Wed Mar 6 15:46:39 2013 From: aclark at aclark.net (Alex Clark) Date: Wed, 6 Mar 2013 09:46:39 -0500 Subject: [Image-SIG] New IRC channel on freenode, "#pil" Message-ID: I don't know if anyone has ever set up an IRC channel for PIL, and I am assuming that no minds if I do (e.g. Fredrik). If you do mind, please let me know! Otherwise, please join me for PIL & Pillow discussion on irc.freenode.net in the #pil channel. More details here: - http://python-imaging.github.com/Pillow/ Alex -- Alex Clark ? http://about.me/alex.clark From aclark at aclark.net Fri Mar 15 18:44:46 2013 From: aclark at aclark.net (Alex Clark) Date: Fri, 15 Mar 2013 13:44:46 -0400 Subject: [Image-SIG] Pillow 2.0.0 released Message-ID: FYI, Pillow 2.0.0 released: - https://pypi.python.org/pypi/Pillow/2.0.0 Please report issues here: - https://github.com/python-imaging/Pillow/issues -- Alex Clark ? http://about.me/alex.clark From felix.schwarz at oss.schwarz.eu Fri Mar 15 21:44:23 2013 From: felix.schwarz at oss.schwarz.eu (Felix Schwarz) Date: Fri, 15 Mar 2013 21:44:23 +0100 Subject: [Image-SIG] How to tell Pillow where to look for header files (on OS X)? Message-ID: <51438827.2060408@oss.schwarz.eu> Hey, how can I specify the include dir for header files (jpeglib.h) for Pillow without modifying the source? I'm on OS X (Mountain Lion) and installed libjpeg using homebrew. There is a 'jpeglib.h' file in ~/homebrew/include but 'python setup.py build' still says 'no jpeg support'. Any ideas/pointers? fs From sienkiew at stsci.edu Fri Mar 15 22:24:39 2013 From: sienkiew at stsci.edu (Mark Sienkiewicz) Date: Fri, 15 Mar 2013 17:24:39 -0400 Subject: [Image-SIG] How to tell Pillow where to look for header files (on OS X)? In-Reply-To: <51438827.2060408@oss.schwarz.eu> References: <51438827.2060408@oss.schwarz.eu> Message-ID: <51439197.5090201@stsci.edu> On 03/15/13 16:44, Felix Schwarz wrote: > Hey, > > how can I specify the include dir for header files (jpeglib.h) for Pillow > without modifying the source? There are parameters for setup.py to specify where the include files and library files are. The interface is a bit klunky, but it worked like this for me: build_ext means to build the C extensions; this command recognizes -I for another directory of include files and -L for another directory of library files python setup.py build_ext -I ~/homebrew/include -L ~/homebrew/lib build means to do both the python and the C extension, but distutils recognizes that the C extension is built already, so you don't need to specify -I/-L -- a good thing, because it doesn't recognize them! python setup.py build install copies the build files to the install directory; the above commands did all of the build steps python setup.py install There are options to specify a specific directory to install in. I usually use: python setup.py install --home ~/py to get ~/py/bin (add to PATH) and ~/py/lib/python (add to PYTHONPATH). Regards, Mark S. From johnson at pharmacy.arizona.edu Fri Mar 15 22:13:52 2013 From: johnson at pharmacy.arizona.edu (Bruce Johnson) Date: Fri, 15 Mar 2013 14:13:52 -0700 Subject: [Image-SIG] How to tell Pillow where to look for header files (on OS X)? In-Reply-To: <51438827.2060408@oss.schwarz.eu> References: <51438827.2060408@oss.schwarz.eu> Message-ID: <260ABE0A-2063-446B-A05D-BD3AA35C3FB0@pharmacy.arizona.edu> On Mar 15, 2013, at 1:44 PM, Felix Schwarz wrote: > Hey, > > how can I specify the include dir for header files (jpeglib.h) for Pillow > without modifying the source? > > I'm on OS X (Mountain Lion) and installed libjpeg using homebrew. There is a > 'jpeglib.h' file in ~/homebrew/include but 'python setup.py build' still says > 'no jpeg support'. > > Any ideas/pointers? Make sure ~/homebrew/include is on your $PATH? -- Bruce Johnson University of Arizona College of Pharmacy Information Technology Group Institutions do not have opinions, merely customs From aclark at aclark.net Fri Mar 15 23:46:36 2013 From: aclark at aclark.net (Alex Clark) Date: Fri, 15 Mar 2013 18:46:36 -0400 Subject: [Image-SIG] How to tell Pillow where to look for header files (on OS X)? References: <51438827.2060408@oss.schwarz.eu> Message-ID: On 2013-03-15 20:44:23 +0000, Felix Schwarz said: > Hey, > > how can I specify the include dir for header files (jpeglib.h) for Pillow > without modifying the source? > > I'm on OS X (Mountain Lion) and installed libjpeg using homebrew. There is a > 'jpeglib.h' file in ~/homebrew/include but 'python setup.py build' still says > 'no jpeg support'. > > Any ideas/pointers? You shouldn't have to. Could something else be wrong? I have the same OS and Homebrew libs? and I get this: -------------------------------------------------------------------- SETUP SUMMARY (Pillow 2.0.0 fork, originally based on PIL 1.1.7) -------------------------------------------------------------------- version 2.0.0 (Pillow) platform darwin 2.7.3 (default, Feb 11 2013, 07:30:37) [GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.24)] -------------------------------------------------------------------- --- TKINTER support available --- JPEG support available --- ZLIB (PNG/ZIP) support available --- TIFF G3/G4 (experimental) support available --- FREETYPE2 support available --- LITTLECMS support available *** WEBP support not available -------------------------------------------------------------------- To add a missing option, make sure you have the required library, and set the corresponding ROOT variable in the setup.py script. To check the build, run the selftest.py script. Alex > fs > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig -- Alex Clark ? http://about.me/alex.clark From felix.schwarz at oss.schwarz.eu Sat Mar 16 10:07:56 2013 From: felix.schwarz at oss.schwarz.eu (Felix Schwarz) Date: Sat, 16 Mar 2013 10:07:56 +0100 Subject: [Image-SIG] How to tell Pillow where to look for header files (on OS X)? In-Reply-To: <260ABE0A-2063-446B-A05D-BD3AA35C3FB0@pharmacy.arizona.edu> References: <51438827.2060408@oss.schwarz.eu> <260ABE0A-2063-446B-A05D-BD3AA35C3FB0@pharmacy.arizona.edu> Message-ID: <5144366C.20102@oss.schwarz.eu> Am 15.03.2013 22:13, schrieb Bruce Johnson: >> I'm on OS X (Mountain Lion) and installed libjpeg using homebrew. There is a >> 'jpeglib.h' file in ~/homebrew/include but 'python setup.py build' still says >> 'no jpeg support'. >> >> Any ideas/pointers? > > Make sure ~/homebrew/include is on your $PATH? Maybe I'm missing something but as far as I know $PATH is only used to find executables but in my case I need to specify the include directory which is usually specified using '-I...' in the compiler call. fs From felix.schwarz at oss.schwarz.eu Sat Mar 16 10:10:15 2013 From: felix.schwarz at oss.schwarz.eu (Felix Schwarz) Date: Sat, 16 Mar 2013 10:10:15 +0100 Subject: [Image-SIG] How to tell Pillow where to look for header files (on OS X)? In-Reply-To: <51439197.5090201@stsci.edu> References: <51438827.2060408@oss.schwarz.eu> <51439197.5090201@stsci.edu> Message-ID: <514436F7.3080001@oss.schwarz.eu> Hi Mark, Am 15.03.2013 22:24, schrieb Mark Sienkiewicz: > build_ext means to build the C extensions; this command recognizes -I for > another directory of include files and -L for another directory of library files > > python setup.py build_ext -I ~/homebrew/include -L ~/homebrew/lib That worked for me. Thanks a lot. Is there any way to set these parameters using environment variables? Pillow is being installed as a dependency for my library so it would be easier if users could set up something beforehand... > There are options to specify a specific directory to install in. I usually use: > > python setup.py install --home ~/py > > to get ~/py/bin (add to PATH) and ~/py/lib/python (add to PYTHONPATH). Well, I have a virtualenv anyway so I don't need that. Thank you very much for your spot-on explanation. fs From felix.schwarz at oss.schwarz.eu Sat Mar 16 10:29:19 2013 From: felix.schwarz at oss.schwarz.eu (Felix Schwarz) Date: Sat, 16 Mar 2013 10:29:19 +0100 Subject: [Image-SIG] How to tell Pillow where to look for header files (on OS X)? In-Reply-To: <514436F7.3080001@oss.schwarz.eu> References: <51438827.2060408@oss.schwarz.eu> <51439197.5090201@stsci.edu> <514436F7.3080001@oss.schwarz.eu> Message-ID: <51443B6F.3000306@oss.schwarz.eu> as a follow-up I hacked together a quick patch so that setup.py checks also special environment variables. Do you think that functionality is interesting for pillow? If so I can submit a pull request. fs -------------- next part -------------- A non-text attachment was scrubbed... Name: pillow-specify-include-dir.patch Type: text/x-patch Size: 543 bytes Desc: not available URL: From charlie.clark at clark-consulting.eu Sat Mar 16 14:23:20 2013 From: charlie.clark at clark-consulting.eu (Charlie Clark) Date: Sat, 16 Mar 2013 14:23:20 +0100 Subject: [Image-SIG] Pillow 2.0.0 released In-Reply-To: References: Message-ID: Am 15.03.2013, 18:44 Uhr, schrieb Alex Clark : > FYI, > Pillow 2.0.0 released: > - https://pypi.python.org/pypi/Pillow/2.0.0 Congratulations on adding Python 3 support! Charlie -- Charlie Clark Managing Director Clark Consulting & Research German Office Kronenstr. 27a D?sseldorf D- 40217 Tel: +49-211-600-3657 Mobile: +49-178-782-6226 From felix.schwarz at oss.schwarz.eu Sat Mar 16 22:18:10 2013 From: felix.schwarz at oss.schwarz.eu (Felix Schwarz) Date: Sat, 16 Mar 2013 22:18:10 +0100 Subject: [Image-SIG] How to tell Pillow where to look for header files (on OS X)? In-Reply-To: References: <51438827.2060408@oss.schwarz.eu> <51443994.2000801@oss.schwarz.eu> Message-ID: <5144E192.1080703@oss.schwarz.eu> Hi, Am 16.03.2013 13:15, schrieb Alex Clark: > Not as far as I can tell. I just tested with /usr/bin/easy_install, after > installing Distribute with the system Python. Seem to be OK. I think that is > the equivalent of what you are doing. Very much so, yes. Can you check if you have the jpeg headers somehow installed system-wide? Is there anything in homebrew I can configure so the headers are linked also in the default include locations? fs From aclark at aclark.net Sun Mar 17 00:30:17 2013 From: aclark at aclark.net (Alex Clark) Date: Sat, 16 Mar 2013 19:30:17 -0400 Subject: [Image-SIG] Pillow 2.0.0 released References: Message-ID: On 2013-03-16 13:23:20 +0000, Charlie Clark said: > Am 15.03.2013, 18:44 Uhr, schrieb Alex Clark : > >> FYI, >> Pillow 2.0.0 released: >> - https://pypi.python.org/pypi/Pillow/2.0.0 > > Congratulations on adding Python 3 support! Thank you! The majority of that work was done by Brian Crowell (https://github.com/fluggo). > > Charlie -- Alex Clark ? http://about.me/alex.clark From aclark at aclark.net Sun Mar 17 13:08:40 2013 From: aclark at aclark.net (Alex Clark) Date: Sun, 17 Mar 2013 08:08:40 -0400 Subject: [Image-SIG] How to tell Pillow where to look for header files (on OS X)? References: <51438827.2060408@oss.schwarz.eu> <51439197.5090201@stsci.edu> <514436F7.3080001@oss.schwarz.eu> <51443B6F.3000306@oss.schwarz.eu> Message-ID: On 2013-03-16 09:29:19 +0000, Felix Schwarz said: > > as a follow-up I hacked together a quick patch so that setup.py checks also > special environment variables. What are "special environment variables"? Variables you defined, or are you setting already existing vars? > > Do you think that functionality is interesting for pillow? If so I can submit > a pull request. Yes, please submit it for review. I'm not sure I fully understand the issue yet, so maybe that will help. IIRC, brew uses very common lib and header path dirs (e.g. /usr/local/lib, /usr/local/include) and Pillow's setup.py certainly already checks those paths. It's good that you were able to get it to work by passing in the path, but I'm not sure why you had to. > fs > > > _______________________________________________ > Image-SIG maillist - Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig -- Alex Clark ? http://about.me/alex.clark From sienkiew at stsci.edu Mon Mar 18 15:28:10 2013 From: sienkiew at stsci.edu (Mark Sienkiewicz) Date: Mon, 18 Mar 2013 10:28:10 -0400 Subject: [Image-SIG] How to tell Pillow where to look for header files (on OS X)? In-Reply-To: <514436F7.3080001@oss.schwarz.eu> References: <51438827.2060408@oss.schwarz.eu> <51439197.5090201@stsci.edu> <514436F7.3080001@oss.schwarz.eu> Message-ID: <5147247A.3060500@stsci.edu> On 03/16/13 05:10, Felix Schwarz wrote: > Hi Mark, > > Am 15.03.2013 22:24, schrieb Mark Sienkiewicz: >> build_ext means to build the C extensions; this command recognizes -I for >> another directory of include files and -L for another directory of library files >> >> python setup.py build_ext -I ~/homebrew/include -L ~/homebrew/lib > That worked for me. Thanks a lot. > > Is there any way to set these parameters using environment variables? Pillow > is being installed as a dependency for my library so it would be easier if > users could set up something beforehand... Not environment variable,s but there is a config file for that. There is some minimal documentation at: http://docs.python.org/2/install/index.html#distutils-configuration-files Mark S. From omid.noroozi at wur.nl Mon Mar 18 15:40:57 2013 From: omid.noroozi at wur.nl (Noroozi, Omid) Date: Mon, 18 Mar 2013 14:40:57 +0000 Subject: [Image-SIG] Unsubscribe Message-ID: <261DD5BA5B785A43B7C34F210687DAF40BCEFA99@SCOMP0935.wurnet.nl> Dear sir, Would you please unsubscribe me from the list of recipients, Thanks -----Original Message----- From: Image-SIG [mailto:image-sig-bounces+omid.noroozi=wur.nl at python.org] On Behalf Of Mark Sienkiewicz Sent: maandag 18 maart 2013 15:28 To: image-sig at python.org Subject: Re: [Image-SIG] How to tell Pillow where to look for header files (on OS X)? On 03/16/13 05:10, Felix Schwarz wrote: > Hi Mark, > > Am 15.03.2013 22:24, schrieb Mark Sienkiewicz: >> build_ext means to build the C extensions; this command recognizes -I >> for another directory of include files and -L for another directory >> of library files >> >> python setup.py build_ext -I ~/homebrew/include -L >> ~/homebrew/lib > That worked for me. Thanks a lot. > > Is there any way to set these parameters using environment variables? > Pillow is being installed as a dependency for my library so it would > be easier if users could set up something beforehand... Not environment variable,s but there is a config file for that. There is some minimal documentation at: http://docs.python.org/2/install/index.html#distutils-configuration-files Mark S. _______________________________________________ Image-SIG maillist - Image-SIG at python.org http://mail.python.org/mailman/listinfo/image-sig From chris.barker at noaa.gov Wed Mar 20 00:50:21 2013 From: chris.barker at noaa.gov (Chris Barker - NOAA Federal) Date: Tue, 19 Mar 2013 16:50:21 -0700 Subject: [Image-SIG] Unsubscribe In-Reply-To: <261DD5BA5B785A43B7C34F210687DAF40BCEFA99@SCOMP0935.wurnet.nl> References: <261DD5BA5B785A43B7C34F210687DAF40BCEFA99@SCOMP0935.wurnet.nl> Message-ID: >> Is there any way to set these parameters using environment variables? >> Pillow is being installed as a dependency for my library so it would >> be easier if users could set up something beforehand... Also, it's a pretty common practice for setup.py files to look in "standard" locations for includes -- i.e. marcports and fink locations on OS-X, maybe we should add the homebrew locations as well (though doesn't homebrew use use/local ? I'd think that would already be on the standard list. -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 lmollea at yahoo.it Sun Mar 3 13:06:41 2013 From: lmollea at yahoo.it (Luciano Mollea) Date: Sun, 03 Mar 2013 12:06:41 -0000 Subject: [Image-SIG] PIL saving corrupted images Message-ID: <1362312399.35628.YahooMailNeo@web171405.mail.ir2.yahoo.com> I am trying to split an image into a number of same-sized chunks to use it as a base for a "Map Tile"/"Map Layer" web application. The image I have is a 30+MB BMP image (24 bit) about 3000x2500 sized. The mapping js library i'm using (leaflet) wants a "tile server" with tiles of 256x256 and an appropriate naming scheme So I used PIL to write a simple python script to create those tiles, cropping pieces from the original image. If I save the tiles to BMP files, everything's fine. If I save them to PNG or JPEG they are corrupted. PNG files complaint that they are invalid files (using pngcheck it tells that the "image may have undergone a unix-dos conversion"). If I use JPG conversion, images are corrupted (I see images as a bunch of 8x8 blocks with just noise instead of the expected image slice). I'm using PIL on Python 2.6.6 on windows 7 64 bit. (mind, I used PIL for another image manipulation script on the same machine and that script works fine) Any hint about what could be wrong? THanks LM -------------- next part -------------- An HTML attachment was scrubbed... URL: From zsheldon at oberlin.edu Mon Mar 4 16:17:13 2013 From: zsheldon at oberlin.edu (Zachary Sheldon) Date: Mon, 04 Mar 2013 15:17:13 -0000 Subject: [Image-SIG] PIL Message-ID: Dear admin or something, I would very much like to install the python imaging library on my computer, but i do not know which directory to save it into -- Zack Sheldon Oberlin College 2015 -------------- next part -------------- An HTML attachment was scrubbed... URL: From DSaunders1 at socal.rr.com Sat Mar 9 19:36:22 2013 From: DSaunders1 at socal.rr.com (Denny Saunders) Date: Sat, 09 Mar 2013 18:36:22 -0000 Subject: [Image-SIG] Installing PIL on 64 bit Windows machine Message-ID: <513B8116.9060908@socal.rr.com> I am trying to install PIL. I have Python 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit (AMD64)] on win32 installed in directory C:/Python27. I downloaded and ran *Python Imaging Library 1.1.7 for Python 2.7 (Windows only)* but it reported that Python 2.7 was not found in the registry. I then attempted to add Python to the registry by running the code given at http://effbot.org/zone/python-register.htm. It then gave me an I/O warning suggesting I add # -*- coding: cp1252 -*- to the file. I selected the "Edit my File" button and it added that line at the top of my code. I then ran the code again and got the following: >>> *** Unable to register! *** You probably have another Python installation! >>> I haven't a clue about what to try next. Is it that I am running 64 bit Windows? -------------- next part -------------- An HTML attachment was scrubbed... URL: From fd_rushhour at yahoo.com Mon Mar 11 02:05:54 2013 From: fd_rushhour at yahoo.com (Freddy Duran) Date: Mon, 11 Mar 2013 01:05:54 -0000 Subject: [Image-SIG] The _imaging C module is not installed Message-ID: <5F33F92F-A716-4ACD-8218-891BA97B7D32@yahoo.com> Dear "Secret Labs", I'm having an issue using the PIL library on a mac OS X Mountain Lion in which I get the following error message when I try to use some of the functions in the PIL library. The _imaging C module is not installed. I've made sure that I had all dependencies updated and installed through ports and I've built your library with the included scripts. I've cleaned, make, verified that the PYTHONPATH includes the library and I've verified that the _imaging.so files are in the directory and I still get the same error. Interesting thing when I try to import the library directly I get the following error message: "_imaging.so mach-o, but wrong architecture". Any thoughts or answers? I see through posts out on the internet that I'm not the only one with this issue, Some have resolved this but looks like none have resolved it using mountain lion. Any help will be greatly appreciated. R, Frustrated Developer From alexelement01 at gmail.com Wed Mar 20 19:36:17 2013 From: alexelement01 at gmail.com (Alex Ethier) Date: Wed, 20 Mar 2013 18:36:17 -0000 Subject: [Image-SIG] IndexError: string index out of range Message-ID: <864D9756-8F8F-4A39-8D72-6528165BADFE@gmail.com> Hi, I'm having troubles processing a PNG image with PIL. I'm getting this error: Traceback (most recent call last): File "test-image.py", line 12, in resized = image.resize((int(sizeX), int(sizeY)), iFilter) File "/Users/alex/Envs/image-lib/lib/python2.7/site-packages/PIL/Image.py", line 1290, in resize self.load() File "/Users/alex/Envs/image-lib/lib/python2.7/site-packages/PIL/ImageFile.py", line 198, in load s = read(self.decodermaxblock) File "/Users/alex/Envs/image-lib/lib/python2.7/site-packages/PIL/PngImagePlugin.py", line 394, in load_read cid, pos, len = self.png.read() File "/Users/alex/Envs/image-lib/lib/python2.7/site-packages/PIL/PngImagePlugin.py", line 99, in read len = i32(s) File "/Users/alex/Envs/image-lib/lib/python2.7/site-packages/PIL/PngImagePlugin.py", line 47, in i32 return ord(c[3]) + (ord(c[2])<<8) + (ord(c[1])<<16) + (ord(c[0])<<24) IndexError: string index out of range If I add a print statement in the PngImagePlugin.py code to print len of c: def i32(c): print len(c) return ord(c[3]) + (ord(c[2])<<8) + (ord(c[1])<<16) + (ord(c[0])<<24) I can see the following when loading the image ... 8 8 8 8 8 8 8 8 8 0 Traceback (most recent call last): File "test-image.py", line 12, in resized = image.resize((int(sizeX), int(sizeY)), iFilter) File "/Users/alex/Envs/image-lib/lib/python2.7/site-packages/PIL/Image.py", line 1290, in resize self.load() File "/Users/alex/Envs/image-lib/lib/python2.7/site-packages/PIL/ImageFile.py", line 198, in load s = read(self.decodermaxblock) File "/Users/alex/Envs/image-lib/lib/python2.7/site-packages/PIL/PngImagePlugin.py", line 394, in load_read cid, pos, len = self.png.read() File "/Users/alex/Envs/image-lib/lib/python2.7/site-packages/PIL/PngImagePlugin.py", line 99, in read len = i32(s) File "/Users/alex/Envs/image-lib/lib/python2.7/site-packages/PIL/PngImagePlugin.py", line 47, in i32 return ord(c[3]) + (ord(c[2])<<8) + (ord(c[1])<<16) + (ord(c[0])<<24) IndexError: string index out of range I'm assuming that the image is "broken" and therefore pil can't load it. but I can load the image in photoshop and preview on the mac. Any idea of what I can do to fix this problem? Thanks. A From paul.furley at dunelm.org.uk Sat Mar 23 10:16:39 2013 From: paul.furley at dunelm.org.uk (Paul Furley) Date: Sat, 23 Mar 2013 09:16:39 -0000 Subject: [Image-SIG] Resampling with antialiasing while using only 8 greyscales Message-ID: Good evening, F irstly, thanks for creating and maintaining such a fantastic library, the PIL is awesome! I've got an interesting problem and I'd really appreciate if someone could point me in the right direction. I'm a reasonable developer but I've become out of my depth in image science :) I've got greyscale images which I have dithered (Floyd-Steinberg) so that they contain exactly 8 shades. The pixel values present in the images are 0, 36, 73, 109, 146, 182, 219, 255 - so 8 levels with pure-white and pure-black being represented. Naturally, most of the 256 possible pixel values in the histogram are empty. I want to reduce the size of this image by 3x in both directions, ie (300, 300) => (100, 100) *with* anti-aliasing but *without* creating pixels outside of those 8 shades. Of course, the Lanczos implementation in PIL doesn't know to only use values 0, 36, 73 etc, so it uses the full 256 range, thereby undoing my dithering work. Can anyone suggest a good approach to this? Would it be possible to modify the resampling algorithm to work in 8 shades rather than 256? Or is there a way I could put the pixel values back into the 8 "buckets" afterwards without wrecking the colour accuracy? I have tried the latter and gradients become steps, as you'd expect. It doesn't seem right to apply dithering again somehow. I have considered re-ordering my process from: *High-res image -> Dithering -> Resampling* to *High-res image -> Resampling -> Dithering* but I then think the dithering process wreaks havoc on the beautifully antialiased edges in the image. Any thoughts would be very gratefully received. Kind regards, Paul -------------- next part -------------- An HTML attachment was scrubbed... URL: From ejsaiet at alaska.edu Fri Mar 29 10:19:17 2013 From: ejsaiet at alaska.edu (Eyal Saiet) Date: Fri, 29 Mar 2013 09:19:17 -0000 Subject: [Image-SIG] using im.getcolor() Message-ID: Hello, I am trying to use your im.getcolor(), can I use it only on g=rgb[1]? green=g.getcolors() For now I am only interested in green colour and how much are they abundant? -- Eyal Saiet -------------- next part -------------- An HTML attachment was scrubbed... URL: