0

Is it possible to convert it into bitmap or icon? I'd like to avoid saving it in file and read it with wx.Bitmap, for example.

xliiv
  • 5,399
  • 5
  • 29
  • 35

1 Answers1

0

This seems to work:

import wx
import gtk

pb = gtk.gdk.pixbuf_new_from_file("someFile.jpg")
img = wx.EmptyImage(pb.get_width(), pb.get_height())
img.SetData(pb.get_pixels())
## you can now convert the wx.Image to wx.Bitmap etc...
Mark
  • 106,305
  • 20
  • 172
  • 230
  • Thanks for answers.. but one thing. Why pb length is 4096 and img is 3072 so i get error about differ size? Is is something with alpha? – xliiv May 30 '11 at 15:03