Posted By

manatlan on 09/10/09


Tagged

image python PIL gtk


Versions (?)

convert a gtk pixbul to a pil image


 / Published in: Python
 

  1. import gtk
  2. import Image
  3.  
  4. def pixbuf2Image(pb):
  5. width,height = pb.get_width(),pb.get_height()
  6. return Image.fromstring("RGB",(width,height),pb.get_pixels() )
  7.  
  8. pb = gtk.gdk.pixbuf_new_from_file( "p20050424_160333.jpg" )
  9. im = pixbuf2Image(pb)
  10. im.save("welldone.jpg", "JPEG",quality=80)

Report this snippet  

You need to login to post a comment.