Loading a texture from database without saving to disk?

Hi,I want to load a texture from database . The image is stored in the database as a base64 string. Is there a way to apply texture to my model without saving to disk?
Thank you

Something like this: (untested)

import base64
from panda3d.core import StringStream, PNMImage

b64image = "aBcD..."

# Decode the image and load it into Panda
stream = StringStream(base64.b64decode(b64image))
image = PNMImage()
image.read(stream, "original_filename.png")

# Create a new texture using the data from our image
tex = Texture()


Passing the original filename to PNMImage.read is optional, but it uses the extension to figure out what the image type is. Otherwise, you can pass a PNMFileType (acquired via the global PNMFileTypeRegistry), or nothing, in which case it will try to use a magic code in the image itself to figure out the type.