python 2.6: how to modify a PIL image from C without copying forth and back
Stefan Behnel
stefan_ml at behnel.de
Wed Mar 3 04:10:22 EST 2010
More information about the Python-list mailing list
Wed Mar 3 04:10:22 EST 2010
- Previous message (by thread): python 2.6: how to modify a PIL image from C without copying forth and back
- Next message (by thread): python 2.6: how to modify a PIL image from C without copying forth and back
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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 > - call my c_function, which copies over the entire image in order > to modify a few pixels > How can I achieve this with the least amount of copies? 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. Stefan
- Previous message (by thread): python 2.6: how to modify a PIL image from C without copying forth and back
- Next message (by thread): python 2.6: how to modify a PIL image from C without copying forth and back
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list