Re: PIL: problem to convert an image array to PIL format

2009-12-17 Thread Sverre
On 17 Des, 15:45, Peter Otten <__pete...@web.de> wrote: > > This has come up before, see > > http://mail.python.org/pipermail/python-list/2009-October/1221578.html > > Peter Thank you! -- http://mail.python.org/mailman/listinfo/python-list

Re: PIL: problem to convert an image array to PIL format

2009-12-17 Thread Peter Otten
Sverre wrote: > After converting a PIL image in memory to an array with numpy.asarray > (), I make a adthreshold() with pymorph() with the result, that all > pixels in the array are either false or true (boolean). But my try to > convert this back into PIL format is failing > > img = Image.fromar

Re: PIL: problem to convert an image array to PIL format

2009-12-17 Thread Robert Franke
Hi, On Thu, Dec 17, 2009 at 1:14 PM, Sverre wrote: > After converting a PIL image in memory to an array with numpy.asarray > (), I make a adthreshold() with pymorph() with the result, that all > pixels in the array are either false or true (boolean). But my try to > convert this back into PIL fo

Re: PIL problem

2008-10-08 Thread J Kenneth King
bfrederi <[EMAIL PROTECTED]> writes: > I am having a problem using PIL. I am trying to crop and image to a > square, starting from the center of the image, but when I try to crop > the image, it won't crop. Here are the relevant code snippets: > > ### Function I am testing ### > def create_square_

Re: PIL problem

2008-10-08 Thread Peter Otten
bfrederi wrote: >> > image.crop((x1,y1,x2,y2)) >> >> This doesn't change `image` but creates and returns a new cropped image >> which you simply ignore. >> >> > image.save(file_name, "JPEG") >> >> Ciao, >> Marc 'BlackJack' Rintsch > > How do I output it to an actual file then? Or overwrite the ex

Re: PIL problem

2008-10-08 Thread bfrederi
On Oct 8, 10:39 am, bfrederi <[EMAIL PROTECTED]> wrote: > On Oct 8, 10:30 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > > > > > On Wed, 08 Oct 2008 08:10:02 -0700, bfrederi wrote: > > > I am having a problem using PIL. I am trying to crop and image to a > > > square, starting from the c

Re: PIL problem

2008-10-08 Thread bfrederi
On Oct 8, 10:39 am, bfrederi <[EMAIL PROTECTED]> wrote: > On Oct 8, 10:30 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > > > > > On Wed, 08 Oct 2008 08:10:02 -0700, bfrederi wrote: > > > I am having a problem using PIL. I am trying to crop and image to a > > > square, starting from the c

Re: PIL problem

2008-10-08 Thread bfrederi
On Oct 8, 10:30 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Wed, 08 Oct 2008 08:10:02 -0700, bfrederi wrote: > > I am having a problem using PIL. I am trying to crop and image to a > > square, starting from the center of the image, but when I try to crop > > the image, it won't cro

Re: PIL problem

2008-10-08 Thread Marc 'BlackJack' Rintsch
On Wed, 08 Oct 2008 08:10:02 -0700, bfrederi wrote: > I am having a problem using PIL. I am trying to crop and image to a > square, starting from the center of the image, but when I try to crop > the image, it won't crop. Here are the relevant code snippets: > > ### Function I am testing ### > de

PIL problem

2008-10-08 Thread bfrederi
I am having a problem using PIL. I am trying to crop and image to a square, starting from the center of the image, but when I try to crop the image, it won't crop. Here are the relevant code snippets: ### Function I am testing ### def create_square_image(file_name): """ Creates a thumbnail siz

PIL Problem

2007-11-07 Thread tonylabarbara
Hi; I´ve installed Zope 2.10.5 on top of Python 2.4.2 (not optimal, but it will work, according to the build instructions). I installed Plone 3.0.2 and I get errors when I crank up Zope, all related to a non-existent PIL. So I d/l/d the latest PIL, plopped it in my Extensions dir, ran this: py

Re: PIL problem: IOError: cannot identify image file

2006-08-20 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > Doh! Apparently Image.open() wants a path, not a file. So > > i = Image.open('c:\\image2.png') > > works fine. it works fine on files too, if you open them in *binary* mode. -- http://mail.python.org/mailman/listinfo/python-list

Re: PIL problem: IOError: cannot identify image file

2006-08-20 Thread h112211
Doh! Apparently Image.open() wants a path, not a file. So i = Image.open('c:\\image2.png') works fine. -- http://mail.python.org/mailman/listinfo/python-list

PIL problem: IOError: cannot identify image file

2006-08-20 Thread h112211
Hi, I installed the newest available PIL (1.1.5 for Python 2.4) from their site, but cannot seem to open any files. The following from PIL import Image i = Image.open(file('c:\\image2.png')) results in File "C:\Program Files\Python24\lib\site-packages\PIL\Image.py", line 1745, in open ra

Re: PIL problem after installation

2006-06-13 Thread Lad
Fredrik Lundh wrote: > Lad wrote: > > > I downloaded jpeg (from ftp://ftp.uu.net/graphics/jpeg/ ) source > > libraries( file jpegsrc.v6b.tar.gz) and installed them. Now in > > /usr/local/lib I have the following files: cjpeg > > ,djpeg,jpegtran,rdjpgcom and wrjpgcom > > cjpeg, djpeg etc are execu

Re: PIL problem after installation

2006-06-12 Thread Fredrik Lundh
Lad wrote: > I downloaded jpeg (from ftp://ftp.uu.net/graphics/jpeg/ ) source > libraries( file jpegsrc.v6b.tar.gz) and installed them. Now in > /usr/local/lib I have the following files: cjpeg > ,djpeg,jpegtran,rdjpgcom and wrjpgcom cjpeg, djpeg etc are executables, not libraries. if you have

Re: PIL problem after installation

2006-06-12 Thread peter
I had similar problems a couple of months back when I was teaching myself Tkinter and PIL. I wrote up my experiences here:- http://www.aqzj33.dsl.pipex.com/how_i_learned_tkinter/contents.htm If you look at the section on Images you will see how I eventually solved it (with bucket loads of help

Re: PIL problem after installation

2006-06-11 Thread Lad
Fredrik Lundh wrote: > Lad wrote: > > > I installed PIL under Linux but now when I try it I get the error: > > > > decoder jpeg not available > > How can I correct that problem? > > if you built PIL yourself, the setup script told you how to fix this. > > - make sure you have right libraries

Re: PIL problem after installation

2006-06-10 Thread vasudevram
Probably the jpeg library - libjpeg is not present on your system. Search Google for it, then download and install it. Try http://rpmfind.net also to find it: http://rpmfind.net/linux/rpm2html/search.php?query=libjpeg&submit=Search+... But Fredrik's advice is very good - whenever installing a so

Re: PIL problem after installation

2006-06-10 Thread Fredrik Lundh
Lad wrote: > I installed PIL under Linux but now when I try it I get the error: > > decoder jpeg not available > How can I correct that problem? if you built PIL yourself, the setup script told you how to fix this. - make sure you have right libraries installed (see the "prerequisit

PIL problem after installation

2006-06-10 Thread Lad
I installed PIL under Linux but now when I try it I get the error: decoder jpeg not available How can I correct that problem? Thank you for help L. -- http://mail.python.org/mailman/listinfo/python-list

Re: PIL problem with biprocessor hardware

2006-05-27 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > oops. lost my train of thought. I was gonna say, I wonder if some of > these image manipulation routines are using multiple threads? PIL doesn't use threading by itself, and I know of quite a few PIL-based systems running on multi-processor hardware (not to mention mul

Re: PIL problem with biprocessor hardware

2006-05-26 Thread [EMAIL PROTECTED]
oops. lost my train of thought. I was gonna say, I wonder if some of these image manipulation routines are using multiple threads? -- http://mail.python.org/mailman/listinfo/python-list

Re: PIL problem with biprocessor hardware

2006-05-26 Thread [EMAIL PROTECTED]
I wonder if there are other threads accessing image? Maybe image isn't fully initialized by some other thread before this code accesses it? It's hard to say what's going wrong. I don't believe that an SMP system would have any bearing on an application unless it uses multiple threads of execution.

Re: PIL problem with biprocessor hardware

2006-05-26 Thread mardif
OK, this is the code: """ image is the object instance of Image class which contains all informations """ pil = Image.open( os.path.join( image.path,image.name ) ) if image.rotation_angle != 2: try: pil = pil.rotate( rotation_lev

Re: PIL problem with biprocessor hardware

2006-05-26 Thread [EMAIL PROTECTED]
> If this application work on a PC mono-processor, I don't have any >problems. >If this application work instead on a PC bi-processor, the process >elaborates an image "corrupted": Sounds like you've got some thread synch issue. On a mono-processor system, your threads are running serially, but on

PIL problem with biprocessor hardware

2006-05-26 Thread mardif
Hi guys, I've a problem, but very big! So, i have a python/PIL application that manipulate images ( rotate, crop, save, etc etc ). If this application work on a PC mono-processor, I don't have any problems. If this application work instead on a PC bi-processor, the process elaborates an image "cor