Display image from base64

Having trouble figuring out how to display an image from a string containing base64. I’ve only found examples of display from files. Do I have to convert it first? Is wxSimpleBitmap the right window to use?

Thanks for any advice,

Take a look at the wx.lib.embeddedimage module. There is also the img2py CLI utility script that can be used to convert an image file to a Python file with the image encoded as base64. As an example, the images.py file in the demo was produced using that tool.

Once you have converted the data to a wx.Bitmap then you can use it that same as if you had loaded the image file directly into the wx.Bitmap.

[Edit: this utility is based on the same technique innovated originally in the lib.embeddedimage solution posted by Robin]

Here is a utility that lets you create a repository of bundled up assets (including various image types) and access them at runtime from a python module. It uses wx to “build in” a GUI manager that lets you extract the contained assets and add/remove stuff, then re-encode it.

Its “Art manager” functions show how it creates images at runtime from the raw data: