[pygtk] image manipulation

Chris Lambacher chris at kateandchris.net
Fri Sep 8 23:32:22 WST 2006


It is possible to directly work with pixel data using Numeric.

http://www.pygtk.org/docs/pygtk/class-gdkpixbuf.html#function-gdk--pixbuf-new-from-array
http://www.pygtk.org/docs/pygtk/class-gdkpixbuf.html#method-gdkpixbuf--get-pixels-array

Using either of these options will give you direct access to manipulate the
pixbuf data as a Numeric array.  If you are displaying the data using a
gtk.Image, just call gtk.Image.queue_draw() after you change the Numeric
array.

-Chris


On Fri, Sep 08, 2006 at 11:44:43AM -0300, Rodrigo Renie Braga wrote:
>    Hello list
> 
>    I would like to know if there is a (easy) way to grab rgb information of
>    an image and then modify it with new rgb information... i'm making an
>    application to apply different set of filters on an image, and i need to,
>    basicly:
>    - load an image
>    - be able to grab the rgb information of a certain pixel
>    - make a new image with a different rgb (calculated by my algorithm)
>    - show that image to the user an then save it to a file
> 
>    what is the best way to work with rgb and image using pygtk?
> 
>    thanks for the attention!
> 
>    --
> 
>    "The best way to sell yourself is to show what you have produced, rather
>    than tell people what you know, what you want to do, or what degrees you
>    have." John Carmack

> _______________________________________________
> pygtk mailing list   pygtk at daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/



More information about the pygtk mailing list