How can I create a wxBitmap from png data already in memory without
having to write it to a file and then loading it?
Thanks
How can I create a wxBitmap from png data already in memory without
having to write it to a file and then loading it?
Thanks
See the ImageFromStream sample in the demo.
On 6/2/10 7:04 PM, Raphael wrote:
How can I create a wxBitmap from png data already in memory without
having to write it to a file and then loading it?
--
Robin Dunn
Software Craftsman
Thanks. I think I should have looked at the demos before asking.
copied from the demo:
data = open(opj('bitmaps/image.png'), "rb").read()
stream = cStringIO.StringIO(data)
bmp = wx.BitmapFromImage(wx.ImageFromStream(stream))
On Jun 3, 1:11 am, Robin Dunn <ro...@alldunn.com> wrote:
See the ImageFromStream sample in the demo.
Hi,
On Fri, Jun 4, 2010 at 1:23 PM, Ray Pasco <raoulpalma@yahoo.com> wrote:
That's *much* too complicated:
bmp = wx.Image( opj('bitmaps/image.png'),
wx.BITMAP_TYPE_ANY ).ConvertToBitmap()Done ! There's no need for all that conversion nonsense
Do you one better
bmp = wx.Bitmap(path_to_file)
He wanted to be able to load it from a stream of already in memory
data though so the use of ImageFromStream would still be necessary for
that use case.
Cody