Re: python 2.6: how to modify a PIL image from C without copying forth and back

2010-03-04 Thread Tim Roberts
News123 wrote: > >Yes, this might be an option >Somehow though it didn't feel right for me to depend on internal non >documented data types, which might change between releases of PIL. That's absolutely true. If performance is a priority, somethimes you have to do things that are "dirty". Just

Re: python 2.6: how to modify a PIL image from C without copying forth and back

2010-03-03 Thread Stefan Behnel
News123, 03.03.2010 10:37: Stefan Behnel wrote: Take a look at Cython instead, it will allow you to access PIL's image buffer directly, instead of copying the data. It will also simplify and speed up your C wrapper code. I don't know Cython. Having looked at the web site I'm not entirely sure,

Re: python 2.6: how to modify a PIL image from C without copying forth and back

2010-03-03 Thread News123
Hi Stefan, Stefan Behnel wrote: > News123, 03.03.2010 01:38: >> I created a grayscale image with PIL. >> >> Now I would like to write a C function, which reads a;most all pixels >> and will modify a few of them. >> >> My current approach is: >> - transform the image to a string() >> - create a byt

Re: python 2.6: how to modify a PIL image from C without copying forth and back

2010-03-03 Thread Stefan Behnel
News123, 03.03.2010 01:38: I created a grayscale image with PIL. Now I would like to write a C function, which reads a;most all pixels and will modify a few of them. My current approach is: - transform the image to a string() - create a byte array huge enough to contain the resulting image - ca

Re: python 2.6: how to modify a PIL image from C without copying forth and back

2010-03-03 Thread News123
Hi Tim, Tim Roberts wrote: > News123 wrote: >> I created a grayscale image with PIL. >> >> Now I would like to write a C function, which reads a;most all pixels >> and will modify a few of them. >> >> My current approach is: >> - transform the image to a string() >> - create a byte array huge eno

Re: python 2.6: how to modify a PIL image from C without copying forth and back

2010-03-02 Thread Tim Roberts
News123 wrote: > >I created a grayscale image with PIL. > >Now I would like to write a C function, which reads a;most all pixels >and will modify a few of them. > >My current approach is: >- transform the image to a string() >- create a byte array huge enough to contain the resulting image >- call

python 2.6: how to modify a PIL image from C without copying forth and back

2010-03-02 Thread News123
Hi, I created a grayscale image with PIL. Now I would like to write a C function, which reads a;most all pixels and will modify a few of them. My current approach is: - transform the image to a string() - create a byte array huge enough to contain the resulting image - call my c_function, which