[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

wx and pil conversion

azrael

3/13/2008 2:48:00 PM

A little problem.

Can I directly show Pil objects "image.open("bla.jpg") in Wx or do I
have to transform them.

If I have to transofm them How can I do it. Pixel by pixel or is there
somethin built in in pil or wx or python.
pilj->wx and wx->pil.

4 Answers

Diez B. Roggisch

3/13/2008 4:09:00 PM

0

azrael wrote:

> A little problem.
>
> Can I directly show Pil objects "image.open("bla.jpg") in Wx or do I
> have to transform them.
>
> If I have to transofm them How can I do it. Pixel by pixel or is there
> somethin built in in pil or wx or python.
> pilj->wx and wx->pil.

PIL doesn't depend on wx, so if anything then wx knows about PIL. But I
doubt it. Instead, use cStringIO and save a PIL-Image to memory, then use
that as file-argument to something that works for wx - no idea what, but
there should be means to load JPEGs and so forth.

If file-objects aren't enough, create a temp-file. No, that's not to slow.

Diez

azrael

3/13/2008 4:32:00 PM

0

I thought of using Temp files but I am afraid of the JPG destorsion
while saving because of the compresion.I am looking for a way to
directly transform it.



On Mar 13, 5:09 pm, "Diez B. Roggisch" <de...@nospam.web.de> wrote:
> azrael wrote:
> > A little problem.
>
> > Can I directly show Pil objects "image.open("bla.jpg") in Wx or do I
> > have to transform them.
>
> > If I have to transofm them How can I do it. Pixel by pixel or is there
> > somethin built in in pil or wx or python.
> > pilj->wx and wx->pil.
>
> PIL doesn't depend on wx, so if anything then wx knows about PIL. But I
> doubt it. Instead, use cStringIO and save a PIL-Image to memory, then use
> that as file-argument to something that works for wx - no idea what, but
> there should be means to load JPEGs and so forth.
>
> If file-objects aren't enough, create a temp-file. No, that's not to slow.
>
> Diez

Diez B. Roggisch

3/13/2008 5:58:00 PM

0

azrael wrote:

> I thought of using Temp files but I am afraid of the JPG destorsion
> while saving because of the compresion.I am looking for a way to
> directly transform it.

Then don't use JPEG, use PNG. It's lossless.

Diez

azrael

3/13/2008 6:26:00 PM

0

On Mar 13, 6:57 pm, "Diez B. Roggisch" <de...@nospam.web.de> wrote:
> azrael wrote:
> > I thought of using Temp files but I am afraid of the JPG destorsion
> > while saving because of the compresion.I am looking for a way to
> > directly transform it.
>
> Then don't use JPEG, use PNG. It's lossless.
>
> Diez

thnx. i did't think about that. i totaly forgot png.