From pancakes at snet.net Thu May 5 03:51:16 2011 From: pancakes at snet.net (Susi) Date: Wed, 4 May 2011 18:51:16 -0700 Subject: [Image-SIG] "ImportError: The _imaging C module is not installed." Message-ID: Hi, if you could help that'd be great. I know absolutely nothing about python; I'm trying to run tutorials but they won't work! I think I installed it wrong. For the PIL specific problem if that's all that matters, please scroll down. *Background*: I'm trying to run a game tutorial I downloaded and keep getting pygame.error: File is not a Windows BMP file I tried putting export VERSIONER_PYTHON_PREFER_32_BIT=yes in terminal, but it didn't help. I'm on Snow Leopard. I've googled the crap out of this. As far as I can tell, the problem is usually that the SDL libraries aren't there. But... in my /Library/Frameworks, I totally have SDL_image, SDL_mixer, SDL_ttf, and SDL.framework. *I decided to use PIL as a temporary workaround. * To my code, I added... def tobmp(img): from PIL import Image originalimage = Image.open(img) convertedimage = originalimage.convert('RGB') return convertedimage Now I get the error, "ImportError: The _imaging C module is not installed." So I tried like the FAQ said - $ python -v ... >>> import Image But I got scary things like >>> import Image # /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk/FixTk.pyc has bad mtime And import _imaging dlopen("/Library/Python/2.6/site-packages/PIL/_imaging.so", 2); Traceback (most recent call last): File "", line 1, in ImportError: dlopen(/Library/Python/2.6/site-packages/PIL/_imaging.so, 2): Symbol not found: _jpeg_resync_to_restart Referenced from: /Library/Python/2.6/site-packages/PIL/_imaging.so Expected in: flat namespace in /Library/Python/2.6/site-packages/PIL/_imaging.so :( If you have any ideas, I'd really appreciate it! Thanks! -- Don't sweat the petty things and don't pet the sweaty things. -------------- next part -------------- An HTML attachment was scrubbed... URL: From Chris.Barker at noaa.gov Fri May 6 17:27:48 2011 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Fri, 06 May 2011 08:27:48 -0700 Subject: [Image-SIG] "ImportError: The _imaging C module is not installed." In-Reply-To: References: Message-ID: <4DC41374.3070605@noaa.gov> We'll need some more info to help: Which OS version? Python version and how did you install it? PIL version and how did you install it? But in short, yes, you do not have a properly installed PIL. You might also ask about both this and the pygame issue on the pythonmac list: http://mail.python.org/mailman/listinfo/pythonmac-sig -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 Fri May 6 23:37:11 2011 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Fri, 06 May 2011 14:37:11 -0700 Subject: [Image-SIG] "ImportError: The _imaging C module is not installed." In-Reply-To: References: <4DC41374.3070605@noaa.gov> Message-ID: <4DC46A07.7020009@noaa.gov> On 5/6/11 1:38 PM, Susi wrote: > Hey! Thanks for your reply. > > I have OSX 10.6.7, Python comes on the mac, so I didn't install it. Personally, I always use the python.org installer for Python, then often third party package binaries are available. Peruse the python-mac list for far more discussion of the trade offs than you'll ever want to read.... But anyway, if you only want to run things on your own machine, then the Apple Python should be fine. > 2.6.1. I installed PIL like this: > > |fink install libjpeg > curl -Ohttp://effbot.org/media/downloads/Imaging-1.1.6.tar.gz > > tar -xzf Imaging-1.1.6.tar.gz > cd Imaging-1.1.6 > sudo python setup.py install Did you get any error messages or anything? I'm not sure that distutils is going to find fink-installed libraries without some tweeking. I also thought there was more than one extra lib needed, but maybe not these days. Anyway, take a careful look at the output to look for hints of problems. I also like to do: python setup.py build sudo python setup.py install so I can see what happens during build, and there is no need for sudo for the build step. > If you have any ideas, please let me know. I also had a question; is PIL > required for python to use images that aren't .bmps? Sorry, I'm totally > new. Thanks again if you reply!! :) something is -- the standard lib doesn't have support for images -- PIL is the most widely used, and a nice choice. -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 Sat May 7 01:45:34 2011 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Fri, 06 May 2011 16:45:34 -0700 Subject: [Image-SIG] "ImportError: The _imaging C module is not installed." In-Reply-To: References: <4DC41374.3070605@noaa.gov> <4DC46A07.7020009@noaa.gov> Message-ID: <4DC4881E.2060506@noaa.gov> On 5/6/11 4:03 PM, Susi wrote: > I installed python 3.2 but with I try to run things with python3 I don't think PIL supports 3.* yet -- if you want the python.org python, use 2.7. There are binaries for PIL here: http://www.astro.washington.edu/users/rowen/python/ you want: PIL-1.1.7-python.org-32bit-py2.7-macosx10.3.dmg Which is compatible with the 32 bit python.org binary. If you need 64 bit, then you'll need to build yourself. > Hmmm, okay. I tweaked the PIL install, then reran it, and made some > progress. In setup.py I changed *JPEG_ROOT = None* to *JPEG_ROOT = > libinclude("/usr/local")* odd -- I thought fink put its stuff in /sw/... > Hmm, the readout seems okay, though I don't know what FreeType2 is - you need that for drawing text on an image. there is a freetype lib provided by Apple, I thought it worked with PIL. > --- ZLIB (PNG/ZIP) support ok > jpgs work now! But pngs still don't. That's odd, given the note above, so I don't knwo what to say -- there is sometest code youi can runin the PIL distro, you might try that for a hint. -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 pancakes at snet.net Fri May 6 22:38:56 2011 From: pancakes at snet.net (Susi) Date: Fri, 6 May 2011 13:38:56 -0700 Subject: [Image-SIG] "ImportError: The _imaging C module is not installed." In-Reply-To: <4DC41374.3070605@noaa.gov> References: <4DC41374.3070605@noaa.gov> Message-ID: Hey! Thanks for your reply. I have OSX 10.6.7, Python comes on the mac, so I didn't install it. It's 2.6.1. I installed PIL like this: fink install libjpeg curl -O http://effbot.org/media/downloads/Imaging-1.1.6.tar.gz tar -xzf Imaging-1.1.6.tar.gz cd Imaging-1.1.6 sudo python setup.py install If you have any ideas, please let me know. I also had a question; is PIL required for python to use images that aren't .bmps? Sorry, I'm totally new. Thanks again if you reply!! :) On Fri, May 6, 2011 at 8:27 AM, Christopher Barker wrote: > We'll need some more info to help: > > Which OS version? > Python version and how did you install it? > PIL version and how did you install it? > > But in short, yes, you do not have a properly installed PIL. > > You might also ask about both this and the pygame issue on the pythonmac > list: > > http://mail.python.org/mailman/listinfo/pythonmac-sig > > > -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 > -- Don't sweat the petty things and don't pet the sweaty things. -------------- next part -------------- An HTML attachment was scrubbed... URL: From pancakes at snet.net Sat May 7 01:03:44 2011 From: pancakes at snet.net (Susi) Date: Fri, 6 May 2011 16:03:44 -0700 Subject: [Image-SIG] "ImportError: The _imaging C module is not installed." In-Reply-To: <4DC46A07.7020009@noaa.gov> References: <4DC41374.3070605@noaa.gov> <4DC46A07.7020009@noaa.gov> Message-ID: Hi, I installed python 3.2 but with I try to run things with python3 I get a symbol not found error for PyCObject_asVoidPtr... whatever that is... so I'm going to stick with python. Hmmm, okay. I tweaked the PIL install, then reran it, and made some progress. In setup.py I changed *JPEG_ROOT = None* to *JPEG_ROOT = libinclude("/usr/local")* Hmm, the readout seems okay, though I don't know what FreeType2 is - --- TKINTER support ok --- JPEG support ok --- ZLIB (PNG/ZIP) support ok *** FREETYPE2 support not available -------------------------------------- jpgs work now! But pngs still don't. "Unable to load background.png". The png is definitely there; I've tried it on like six different ones ><. Thanks for taking the time to look at this!!!!!!!!!!!!!!!!!!! On Fri, May 6, 2011 at 2:37 PM, Christopher Barker wrote: > On 5/6/11 1:38 PM, Susi wrote: > >> Hey! Thanks for your reply. >> >> I have OSX 10.6.7, Python comes on the mac, so I didn't install it. >> > > Personally, I always use the python.org installer for Python, then often > third party package binaries are available. Peruse the python-mac list for > far more discussion of the trade offs than you'll ever want to read.... > > But anyway, if you only want to run things on your own machine, then the > Apple Python should be fine. > > 2.6.1. I installed PIL like this: >> >> |fink install libjpeg >> curl -Ohttp://effbot.org/media/downloads/Imaging-1.1.6.tar.gz >> >> >> tar -xzf Imaging-1.1.6.tar.gz >> cd Imaging-1.1.6 >> sudo python setup.py install >> > > Did you get any error messages or anything? I'm not sure that distutils is > going to find fink-installed libraries without some tweeking. I also thought > there was more than one extra lib needed, but maybe not these days. > > Anyway, take a careful look at the output to look for hints of problems. > > I also like to do: > > python setup.py build > > sudo python setup.py install > > so I can see what happens during build, and there is no need for sudo for > the build step. > > > If you have any ideas, please let me know. I also had a question; is PIL >> required for python to use images that aren't .bmps? Sorry, I'm totally >> new. Thanks again if you reply!! :) >> > > something is -- the standard lib doesn't have support for images -- PIL is > the most widely used, and a nice choice. > > > -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 > -- Don't sweat the petty things and don't pet the sweaty things. -------------- next part -------------- An HTML attachment was scrubbed... URL: From george at reilly.org Mon May 9 18:34:38 2011 From: george at reilly.org (George V. Reilly) Date: Mon, 9 May 2011 09:34:38 -0700 Subject: [Image-SIG] Natty: Python Imaging Library in a virtualenv - no JPEG or PNG support Message-ID: I'm unable to build PIL with JPEG and PNG support in Ubuntu 11.04. I posted this to http://ubuntuforums.org/showthread.php?t=1751455 on Friday but have received no responses. We build our Python webservices in a virtualenv with all external packages stored locally. This gives us reproducible results on a variety of Linux distros, Mac, and Windows, both for developer machines and production boxes. Here's a repro case in a clean virtual machine. $ sudo apt-get install python-virtualenv $ virtualenv --no-site-packages ~/venv $ source ~/venv/bin/activate $ mkdir -p ~/PIL ~/temp/site-packages $ export PYTHONPATH=~/temp/site-packages/ $ cd ~/PIL $ wget http://effbot.org/downloads/Imaging-1.1.7.tar.gz $ sudo apt-get build-dep python-imaging # sets up zlib1g-dev, libfreetype6-dev, libjpeg62-dev, liblcms1-dev, ... $ easy_install -v --install-dir ~/temp/site-packages --find-links ~/PIL\ --allow-hosts=None --always-unzip Imaging ... -------------------------------------------------------------------- PIL 1.1.7 SETUP SUMMARY -------------------------------------------------------------------- version 1.1.7 platform linux2 2.7.1+ (r271:86832, Apr 11 2011, 18:05:24) [GCC 4.5.2] -------------------------------------------------------------------- --- TKINTER support available *** JPEG support not available *** ZLIB (PNG/ZIP) support not available *** FREETYPE2 support not available --- LITTLECMS support available -------------------------------------------------------------------- $ identify basketball.png flowers.jpg logo.gif basketball.png PNG 340x340 340x340+0+0 8-bit DirectClass 157KB 0.000u 0:00.000 flowers.jpg[1] JPEG 500x333 500x333+0+0 8-bit DirectClass 66.5KB 0.020u 0:00.019 logo.gif[2] GIF 276x110 276x110+0+0 8-bit PseudoClass 256c 8.56KB 0.000u 0:00.000 $ python Python 2.7.1+ (r271:86832, Apr 11 2011, 18:05:24) [GCC 4.5.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import Image >>> img = Image.open('basketball.png') >>> img.load() Traceback (most recent call last): File "", line 1, in File "/home/georger/temp/site-packages/PIL-1.1.7-py2.7-linux-i686.egg/ImageFile.py", line 189, in load d = Image._getdecoder(self.mode, d, a, self.decoderconfig) File "/home/georger/temp/site-packages/PIL-1.1.7-py2.7-linux-i686.egg/Image.py", line 385, in _getdecoder raise IOError("decoder %s not available" % decoder_name) IOError: decoder zip not available >>> img = Image.open('flowers.jpg') >>> img.load() Traceback (most recent call last): File "", line 1, in File "/home/georger/temp/site-packages/PIL-1.1.7-py2.7-linux-i686.egg/ImageFile.py", line 189, in load d = Image._getdecoder(self.mode, d, a, self.decoderconfig) File "/home/georger/temp/site-packages/PIL-1.1.7-py2.7-linux-i686.egg/Image.py", line 385, in _getdecoder raise IOError("decoder %s not available" % decoder_name) IOError: decoder jpeg not available Ideas? -- /George V. Reilly? george at reilly.org? Twitter: @georgevreilly http://www.georgevreilly.com/blog? http://blogs.cozi.com/tech From Chris.Barker at noaa.gov Mon May 9 19:01:55 2011 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Mon, 09 May 2011 10:01:55 -0700 Subject: [Image-SIG] Natty: Python Imaging Library in a virtualenv - no JPEG or PNG support In-Reply-To: References: Message-ID: <4DC81E03.8090306@noaa.gov> On 5/9/11 9:34 AM, George V. Reilly wrote: > We build our Python web services in a virtualenv with all external > packages stored locally. ... > $ easy_install -v --install-dir ~/temp/site-packages --find-links ~/PIL\ > --allow-hosts=None --always-unzip Imaging PIL is know to have issues with setuptools, and, I think virtualenv. See this: http://pypi.python.org/pypi/Pillow/1.6 The first thing I'd try is a straight: setup.py build install, without virtualenv That will tell you whether it is a setuptools and/or virtualenv issue. Some googling will get you other hints, or maybe it's as simple as: easy_install pillow -HTH, - 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 songofacandy at gmail.com Mon May 9 19:07:30 2011 From: songofacandy at gmail.com (INADA Naoki) Date: Tue, 10 May 2011 02:07:30 +0900 Subject: [Image-SIG] Natty: Python Imaging Library in a virtualenv - no JPEG or PNG support In-Reply-To: References: Message-ID: I've edited the setup.py like below: --- # TIFF_ROOT = libinclude("/opt/tiff") TCL_ROOT = None JPEG_ROOT = '/usr/lib/x86_64-linux-gnu', '/usr/include' # libjpeg and libpng are here. ZLIB_ROOT = JPEG_ROOT TIFF_ROOT = None FREETYPE_ROOT = JPEG_ROOT LCMS_ROOT = None --- On Tue, May 10, 2011 at 1:34 AM, George V. Reilly wrote: > I'm unable to build PIL with JPEG and PNG support in Ubuntu 11.04. I > posted this to http://ubuntuforums.org/showthread.php?t=1751455 on > Friday but have received no responses. > > We build our Python webservices in a virtualenv with all external > packages stored locally. This gives us reproducible results on a > variety of Linux distros, Mac, and Windows, both for developer > machines and production boxes. > > Here's a repro case in a clean virtual machine. > > $ sudo apt-get install python-virtualenv > $ virtualenv --no-site-packages ~/venv > $ source ~/venv/bin/activate > > $ mkdir -p ~/PIL ~/temp/site-packages > $ export PYTHONPATH=~/temp/site-packages/ > $ cd ~/PIL > $ wget http://effbot.org/downloads/Imaging-1.1.7.tar.gz > > $ sudo apt-get build-dep python-imaging > # sets up zlib1g-dev, libfreetype6-dev, libjpeg62-dev, liblcms1-dev, ... > > $ easy_install -v --install-dir ~/temp/site-packages --find-links ~/PIL\ > ?--allow-hosts=None --always-unzip Imaging > > ... > -------------------------------------------------------------------- > PIL 1.1.7 SETUP SUMMARY > -------------------------------------------------------------------- > version ? ? ? 1.1.7 > platform ? ? ?linux2 2.7.1+ (r271:86832, Apr 11 2011, 18:05:24) > ? ? ? ? ? ? ?[GCC 4.5.2] > -------------------------------------------------------------------- > --- TKINTER support available > *** JPEG support not available > *** ZLIB (PNG/ZIP) support not available > *** FREETYPE2 support not available > --- LITTLECMS support available > -------------------------------------------------------------------- > > $ identify basketball.png flowers.jpg logo.gif > basketball.png PNG 340x340 340x340+0+0 8-bit DirectClass 157KB 0.000u 0:00.000 > flowers.jpg[1] JPEG 500x333 500x333+0+0 8-bit DirectClass 66.5KB 0.020u 0:00.019 > logo.gif[2] GIF 276x110 276x110+0+0 8-bit PseudoClass 256c 8.56KB > 0.000u 0:00.000 > > $ python > Python 2.7.1+ (r271:86832, Apr 11 2011, 18:05:24) > [GCC 4.5.2] on linux2 > Type "help", "copyright", "credits" or "license" for more information. >>>> import Image >>>> img = Image.open('basketball.png') >>>> img.load() > Traceback (most recent call last): > ?File "", line 1, in > ?File "/home/georger/temp/site-packages/PIL-1.1.7-py2.7-linux-i686.egg/ImageFile.py", > line 189, in load > ? ?d = Image._getdecoder(self.mode, d, a, self.decoderconfig) > ?File "/home/georger/temp/site-packages/PIL-1.1.7-py2.7-linux-i686.egg/Image.py", > line 385, in _getdecoder > ? ?raise IOError("decoder %s not available" % decoder_name) > IOError: decoder zip not available >>>> img = Image.open('flowers.jpg') >>>> img.load() > Traceback (most recent call last): > ?File "", line 1, in > ?File "/home/georger/temp/site-packages/PIL-1.1.7-py2.7-linux-i686.egg/ImageFile.py", > line 189, in load > ? ?d = Image._getdecoder(self.mode, d, a, self.decoderconfig) > ?File "/home/georger/temp/site-packages/PIL-1.1.7-py2.7-linux-i686.egg/Image.py", > line 385, in _getdecoder > ? ?raise IOError("decoder %s not available" % decoder_name) > IOError: decoder jpeg not available > > Ideas? > -- > /George V. Reilly? george at reilly.org? Twitter: @georgevreilly > http://www.georgevreilly.com/blog? http://blogs.cozi.com/tech > _______________________________________________ > Image-SIG maillist ?- ?Image-SIG at python.org > http://mail.python.org/mailman/listinfo/image-sig > -- INADA Naoki? From charlie.clark at clark-consulting.eu Thu May 12 12:17:37 2011 From: charlie.clark at clark-consulting.eu (Charlie Clark) Date: Thu, 12 May 2011 12:17:37 +0200 Subject: [Image-SIG] Natty: Python Imaging Library in a virtualenv - no JPEG or PNG support In-Reply-To: References: Message-ID: Am 09.05.2011, 18:34 Uhr, schrieb George V. Reilly : > I'm unable to build PIL with JPEG and PNG support in Ubuntu 11.04. I > posted this to http://ubuntuforums.org/showthread.php?t=1751455 on > Friday but have received no responses. > We build our Python webservices in a virtualenv with all external > packages stored locally. This gives us reproducible results on a > variety of Linux distros, Mac, and Windows, both for developer > machines and production boxes. PIL isn't safe for use with easy_install. I hope that Naoki's post about the x86_64 libraries has helped as this came up recently. For virtualenv's the best choice, however, is to use the Pillow fork of PIL which runs fine with easy_install or pip. Oh, and try to avoid "activate" unless you're very confident of what you're doing. Charlie -- Charlie Clark Managing Director Clark Consulting & Research German Office Helmholtzstr. 20 D?sseldorf D- 40215 Tel: +49-211-600-3657 Mobile: +49-178-782-6226 From charlie.clark at clark-consulting.eu Thu May 12 12:25:02 2011 From: charlie.clark at clark-consulting.eu (Charlie Clark) Date: Thu, 12 May 2011 12:25:02 +0200 Subject: [Image-SIG] "ImportError: The _imaging C module is not installed." In-Reply-To: <4DC4881E.2060506@noaa.gov> References: <4DC41374.3070605@noaa.gov> <4DC46A07.7020009@noaa.gov> <4DC4881E.2060506@noaa.gov> Message-ID: Am 07.05.2011, 01:45 Uhr, schrieb Christopher Barker : > I don't think PIL supports 3.* yet -- if you want the python.org python, > use 2.7. The alternative is to use the MacPorts version which is 64-bit only but which for which many packages exist as ports: sudo port install py27-pil This puts Python in /opt/local/bin and allows easy management of different versions. It will automatically install any dependencies such as lib-JPEG and lib-freetype. As it provides a mechanism for upgrading existing packages I prefer this over the binary installs. Apple virtually never updates the subsystem between OS releases. Charlie -- Charlie Clark Managing Director Clark Consulting & Research German Office Helmholtzstr. 20 D?sseldorf D- 40215 Tel: +49-211-600-3657 Mobile: +49-178-782-6226 From leegold at operamail.com Mon May 16 21:08:38 2011 From: leegold at operamail.com (Lee Gold) Date: Mon, 16 May 2011 12:08:38 -0700 Subject: [Image-SIG] Image processing to auto adjust colors in python ? Message-ID: <1305572918.11951.1452551053@webmail.messagingengine.com> Hi, I'm processing thumbnails with python but one thing I need to do is to auto-adjust an image for the "best" colors. I am using ffmpeg to get thumbs three seconds into a video, sometimes the image is too dark. Normally I'd go into something like the windows program Irfan View and do "Auto Adjust Colors", but I need a command-line solution to processes hundreds of images in a loop. I'm using Ubuntu and Python. Is there a way in PIL I could do this? thanks, Lee G. -- http://www.fastmail.fm - Same, same, but different... From charlie.clark at clark-consulting.eu Mon May 16 21:52:02 2011 From: charlie.clark at clark-consulting.eu (Charlie Clark) Date: Mon, 16 May 2011 21:52:02 +0200 Subject: [Image-SIG] Image processing to auto adjust colors in python ? In-Reply-To: <1305572918.11951.1452551053@webmail.messagingengine.com> References: <1305572918.11951.1452551053@webmail.messagingengine.com> Message-ID: Am 16.05.2011, 21:08 Uhr, schrieb Lee Gold : > Hi, > I'm processing thumbnails with python but one thing I need to do is to > auto-adjust an image for the "best" colors. I am using ffmpeg to get > thumbs three seconds into a video, sometimes the image is too dark. > Normally I'd go into something like the windows program Irfan View and > do "Auto Adjust Colors", but I need a command-line solution to > processes hundreds of images in a loop. I'm using Ubuntu and Python. > Is there a way in PIL I could do this? Hi Lee, assuming you can write the correct image processing algorithm or find a suitable filter you can do this in PIL. However, you mind try applying filters directly in ffmpeg before you create a thumbnail. Charlie -- Charlie Clark Managing Director Clark Consulting & Research German Office Helmholtzstr. 20 D?sseldorf D- 40215 Tel: +49-211-600-3657 Mobile: +49-178-782-6226 From george at reilly.org Wed May 18 01:35:27 2011 From: george at reilly.org (George V. Reilly) Date: Tue, 17 May 2011 16:35:27 -0700 Subject: [Image-SIG] Natty: Python Imaging Library in a virtualenv - no JPEG or PNG support In-Reply-To: References: Message-ID: On Thu, May 12, 2011 at 3:17 AM, Charlie Clark wrote: > > Am 09.05.2011, 18:34 Uhr, schrieb George V. Reilly : > >> I'm unable to build PIL with JPEG and PNG support in Ubuntu 11.04. I >> posted this to http://ubuntuforums.org/showthread.php?t=1751455 on >> Friday but have received no responses. >> We build our Python webservices in a virtualenv with all external >> packages stored locally. This gives us reproducible results on a >> variety of Linux distros, Mac, and Windows, both for developer >> machines and production boxes. > > PIL isn't safe for use with easy_install. I hope that Naoki's post about the x86_64 libraries has helped as this came up recently. > > For virtualenv's the best choice, however, is to use the Pillow fork of PIL which runs fine with easy_install or pip. Oh, and try to avoid "activate" unless you're very confident of what you're doing. Thanks, Charlie et al. Ultimately, what I ended up doing was symlinking libjpeg.so and libz.so into /usr/lib, as earlier versions of Ubuntu did: $ pushd /usr/lib $ sudo ln -s i386-linux-gnu/libjpeg.so libjpeg.so $ sudo ln -s i386-linux-gnu/libz.so libz.so -- /George V. Reilly? george at reilly.org? Twitter: @georgevreilly http://www.georgevreilly.com/blog? http://blogs.cozi.com/tech From JRadinger at gmx.at Wed May 18 12:26:57 2011 From: JRadinger at gmx.at (Johannes Radinger) Date: Wed, 18 May 2011 12:26:57 +0200 Subject: [Image-SIG] Problems with ghostscript Message-ID: <20110518102657.42950@gmx.net> Hello, I just installed PIL on my mac osx 10.6.6 under python 2.6.6 and tried one of your first examples (slightly modified). I tried following script: import Image import PSDraw im = Image.open("testplot.eps") title = "lena" box = (1*72, 2*72, 7*72, 10*72) # in points ps = PSDraw.PSDraw() # default is sys.stdout ps.begin_document(title) # draw the image (75 dpi) ps.image(box, im, 75) ps.rectangle(box) # draw centered title ps.setfont("HelveticaNarrow-Bold", 36) w, h, b = ps.textsize(title) ps.text((4*72-w/2, 1*72-h), title) ps.end_document() but then I get the error: Traceback (most recent call last): File "/Users/Johannes Radinger/Desktop/Python Scripts/test.py", line 10, in ps.image(box, im, 75) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PIL/PSDraw.py", line 105, in image EpsImagePlugin._save(im, self.fp, None, 0) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PIL/EpsImagePlugin.py", line 296, in _save im.load() File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PIL/EpsImagePlugin.py", line 283, in load self.im = Ghostscript(self.tile, self.size, self.fp) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PIL/EpsImagePlugin.py", line 75, in Ghostscript raise IOError("gs failed (status %d)" % status) IOError: gs failed (status 32512) What causes the problem?? /johannes -- NEU: FreePhone - kostenlos mobil telefonieren und surfen! Jetzt informieren: http://www.gmx.net/de/go/freephone From charlie.clark at clark-consulting.eu Wed May 18 20:45:08 2011 From: charlie.clark at clark-consulting.eu (Charlie Clark) Date: Wed, 18 May 2011 20:45:08 +0200 Subject: [Image-SIG] Problems with ghostscript In-Reply-To: <20110518102657.42950@gmx.net> References: <20110518102657.42950@gmx.net> Message-ID: Am 18.05.2011, 12:26 Uhr, schrieb Johannes Radinger : > Traceback (most recent call last): > File "/Users/Johannes Radinger/Desktop/Python Scripts/test.py", line > 10, in > ps.image(box, im, 75) > File > "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PIL/PSDraw.py", > line 105, in image > EpsImagePlugin._save(im, self.fp, None, 0) > File > "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PIL/EpsImagePlugin.py", > line 296, in _save > im.load() > File > "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PIL/EpsImagePlugin.py", > line 283, in load > self.im = Ghostscript(self.tile, self.size, self.fp) > File > "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PIL/EpsImagePlugin.py", > line 75, in Ghostscript > raise IOError("gs failed (status %d)" % status) > IOError: gs failed (status 32512) > What causes the problem?? Hi Johannes, have you got Ghostscript installed on your system? It looks like you are getting an error because PIL can't find it. Charlie -- Charlie Clark Managing Director Clark Consulting & Research German Office Helmholtzstr. 20 D?sseldorf D- 40215 Tel: +49-211-600-3657 Mobile: +49-178-782-6226 From skylar.saveland at gmail.com Wed May 18 20:39:16 2011 From: skylar.saveland at gmail.com (Skylar Saveland) Date: Wed, 18 May 2011 14:39:16 -0400 Subject: [Image-SIG] The correct pattern for Image.split Message-ID: Hello All, Interesting, with a freshly opened tiff, I can't call split until I do something else. I found that I can call .getdata and then split works. What is the correct pattern? In [28]: green.split() --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) .../lib/python2.6/site-packages/PIL/Image.pyc in split(self) 1495 "Split image into bands" 1496 -> 1497 if self.im.bands == 1: 1498 ims = [self.copy()] 1499 else: AttributeError: 'NoneType' object has no attribute 'bands' In [29]: green.getdata() Out[29]: In [30]: green.split() Out[30]: (, , ) Skylar -------------- next part -------------- An HTML attachment was scrubbed... URL: From pdiffley12 at gmail.com Thu May 19 05:45:03 2011 From: pdiffley12 at gmail.com (Phillip Diffley) Date: Wed, 18 May 2011 22:45:03 -0500 Subject: [Image-SIG] How to install? Message-ID: Hi, I am trying to install the PIL libraries but am not sure how to. I saw in the read me file that i should do this: $ tar xvfz Imaging-1.1.7.tar.gz $ cd Imaging-1.1.7 $ python setup.py install but have no idea what that means. I am running windows 7 if that makes a difference. Phillip Diffley -------------- next part -------------- An HTML attachment was scrubbed... URL: From tablackmore at gmail.com Fri May 20 11:00:46 2011 From: tablackmore at gmail.com (Tom Blackmore) Date: Fri, 20 May 2011 11:00:46 +0200 Subject: [Image-SIG] Png24 to GIF image size Message-ID: Hi All, I'm having problems converting a png24 to a gif image. The conversion works, it's just the gif file is very large. The example C00000004.png is 14k. When I convert it to a gif with pil the file is 17k (test_pil.gif). If I use a Java library the gif is only 7k ( test_java.gif). I've got about 10000000 images to process so this is quite a big deal. I've enclosed an example of a png that I'm trying to convert C00000004.png and the result from my conversion with PIL (test_pil.gif) and the result from Java conversion test_java.pil. The Python code I'm using: im = Image.open(path + 'C00000004.png') im = im.convert('RGB').convert('P', palette=Image.ADAPTIVE) im.save(path + 'test.gif','gif') In the Java version I'm using ImageIO like this. ImageIO.write(img, "gif", outputfile); Am I missing something? Thanks in advance for any help. Kind regards Tom -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: C00000004.png Type: image/png Size: 13580 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: test_java.gif Type: image/gif Size: 6431 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: test_pil.gif Type: image/gif Size: 16556 bytes Desc: not available URL: From tong.qingwen at onkok.com Fri May 20 09:47:02 2011 From: tong.qingwen at onkok.com (=?big5?B?T05LT0stIFRvbmcgUWluZyBXZW4gtaO8eaTl?=) Date: Fri, 20 May 2011 15:47:02 +0800 Subject: [Image-SIG] questions on the Python Imaging Library Message-ID: <003201cc16c2$1c72e4e0$7c01000a@Tongqingwen> Dear Py, import Image img = Image.open("py.jpg") img = img.transform( (640,480), Image.QUAD, (0,0,0,480,640+320,480+240,640,0) ) img.show() I find there is a problem for picture deformation . Please reply to tongqingwen1 at 163.com and tong.qingwen at onkok.com .TKS! Best Regards -------------- next part -------------- An HTML attachment was scrubbed... URL: From Chris.Barker at noaa.gov Fri May 20 20:11:03 2011 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Fri, 20 May 2011 11:11:03 -0700 Subject: [Image-SIG] How to install? In-Reply-To: References: Message-ID: <4DD6AEB7.1050109@noaa.gov> On 5/18/11 8:45 PM, Phillip Diffley wrote: > I am trying to install the PIL libraries but am not sure how to. I saw > in the read me file that i should do this: > > $ tar xvfz Imaging-1.1.7.tar.gz > > $ cd Imaging-1.1.7 > > $ python setup.py install > > but have no idea what that means. I am running windows 7 if that makes a > difference. that's ow you copile it yourself, and will only work out-of-the box on a *nix system On Windows, you probably want a binary installer: http://www.pythonware.com/products/pil/ look for the "Windows only" builds, and find one that matches your Python install. -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 Fri May 20 20:08:41 2011 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Fri, 20 May 2011 11:08:41 -0700 Subject: [Image-SIG] Png24 to GIF image size In-Reply-To: References: Message-ID: <4DD6AE29.2060501@noaa.gov> On 5/20/11 2:00 AM, Tom Blackmore wrote: > I'm having problems converting a png24 to a gif image. The conversion > works, it's just the gif file is very large. I'm not speaking with authority here, but back when the "GIF patent" was still active, some Open Source GIF drivers didn't compress, as the compression was the patented part of the format. So that _may_ be the case here. -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 charlie.clark at clark-consulting.eu Fri May 20 22:33:58 2011 From: charlie.clark at clark-consulting.eu (Charlie Clark) Date: Fri, 20 May 2011 22:33:58 +0200 Subject: [Image-SIG] Png24 to GIF image size In-Reply-To: <4DD6AE29.2060501@noaa.gov> References: <4DD6AE29.2060501@noaa.gov> Message-ID: Am 20.05.2011, 20:08 Uhr, schrieb Christopher Barker : > I'm not speaking with authority here, but back when the "GIF patent" was > still active, some Open Source GIF drivers didn't compress, as the > compression was the patented part of the format. > So that _may_ be the case here. Nah, Unisys patented the format which essentially uses a 256 colour palette for compression. LZW compression doesn't make much difference on this file. I *think* the problem is you are not creating the palette very intelligently there are only 20 colours in the palette. Charlie -- Charlie Clark Managing Director Clark Consulting & Research German Office Helmholtzstr. 20 D?sseldorf D- 40215 Tel: +49-211-600-3657 Mobile: +49-178-782-6226 From charlie.clark at clark-consulting.eu Fri May 20 22:36:21 2011 From: charlie.clark at clark-consulting.eu (Charlie Clark) Date: Fri, 20 May 2011 22:36:21 +0200 Subject: [Image-SIG] questions on the Python Imaging Library In-Reply-To: <003201cc16c2$1c72e4e0$7c01000a@Tongqingwen> References: <003201cc16c2$1c72e4e0$7c01000a@Tongqingwen> Message-ID: Am 20.05.2011, 09:47 Uhr, schrieb ONKOK- Tong Qing Wen ??? : > I find there is a problem for picture deformation . Dear Wen, I find the e-mail is missing a lot of information. That said there is known issue with JPEGs when they are geometrically translated. If possible it is much better to work with the original bitmap. Charlie -- Charlie Clark Managing Director Clark Consulting & Research German Office Helmholtzstr. 20 D?sseldorf D- 40215 Tel: +49-211-600-3657 Mobile: +49-178-782-6226 From akekhofananaye at yahoo.co.uk Tue May 24 17:14:13 2011 From: akekhofananaye at yahoo.co.uk (SKHUMBUZO ZIKHALI) Date: Tue, 24 May 2011 16:14:13 +0100 (BST) Subject: [Image-SIG] Codes with image does do not run Message-ID: <558224.9311.qm@web24003.mail.ird.yahoo.com> Hi: I am learning Python on my own using a " Guide to Programming with Python" book.?Author of the book is Micheal?Dawson and I am using version 2.3.5 of python. ?When I try to run the code?I do?not get required results. The picture could not be loaded. I get trackback message regarding undefined module.The example from the book is as follows: from liveswires import games games.init(screen_width = 640, screen_height = 480, fps = 50) wall_image = games.load_image("wall.jpg", transparent = False) games.screen.background = wall_image games.screen.mainloop() Can anyone please assist me. Thank you Sikhumbuzo -------------- next part -------------- An HTML attachment was scrubbed... URL: From charlie.clark at clark-consulting.eu Sat May 28 18:13:41 2011 From: charlie.clark at clark-consulting.eu (Charlie Clark) Date: Sat, 28 May 2011 18:13:41 +0200 Subject: [Image-SIG] Codes with image does do not run In-Reply-To: <558224.9311.qm@web24003.mail.ird.yahoo.com> References: <558224.9311.qm@web24003.mail.ird.yahoo.com> Message-ID: Am 24.05.2011, 17:14 Uhr, schrieb SKHUMBUZO ZIKHALI : > I am learning Python on my own using a " Guide to Programming with > Python" > book. Author of the book is Micheal Dawson and I am using version 2.3.5 > of > python. When I try to run the code I do not get required results. The > picture > could not be loaded. I get trackback message regarding undefined > module.The > example from the book is as follows: > from liveswires import games > games.init(screen_width = 640, screen_height = 480, fps = 50) > wall_image = games.load_image("wall.jpg", transparent = False) > games.screen.background = wall_image > games.screen.mainloop() > Can anyone please assist me. Dear Sikhumbuzo, I suspect the problem has nothing to do with PIL, the Python Image Library. Have you installed the "liveswires" package you mention? Presumably to book comes with a CD containing the software. Otherwise we need to know the precise error you are getting. By the way Python 2.3 is very old and not supported you should consider updating to Python 2.7 if possible. Charlie -- Charlie Clark Managing Director Clark Consulting & Research German Office Helmholtzstr. 20 D?sseldorf D- 40215 Tel: +49-211-600-3657 Mobile: +49-178-782-6226