String to Picture

I have a database with a String-type column which contains serialized data from a PNG. How do I construct a picture from this data?
I tried:

var MB as memoryblock
var MyPicture as new Picture
MB = MyRowSet.Column("PicData").ToString
MyPicture.FromData(MB)

But MB is empty. I tried to put the PicData in a String var first and read that into a MB but it fails.

I use encodebase64 and decodebase64 to store pictures in a database
because if you use strings, you can have characters that are filtered
base64 ensure you only have ascii characters in the string.

Don’t you want MyRowSet.Column("PicData").StringValue?
MyRowset.Column() returns an object, so ToString isn’t going to do what you expect.

Yes, typo. The thing is, I load a rowset into a String type multidim array. So far so good. The array element contains the PNG data. But when I try to convert it back into a Picture, the array won’t release the data.

MB = OrganisatiesArray(i,7) 'type string and holds data - verified
MapImage = Picture.FromData(MB)

MB is empty. When I do

var TempString as String
TempString = OrganisatiesArray(i,7) 
MB = TempString
MapImage = Picture.FromData(MB)

TempString is empty, so MB is empty too. It looks like the array won’t release the data (250kB).
No idea why this is.

I use PictureToJPEGStringMBS and JPEGStringToPictureMBS and it works great. Very fast and at 100% quality no quality loss. additionally a jpeg string take less db storage space. If you have the MBS plugins I’d recommed you try it.

// p is a picture, 100 is the jpeg quality
Var pstrng As String = PictureToJPEGStringMBS(p,100)
// Store the string into the DB
// convert the string back to a picture after retrieving it from the DB
Var p As Picture = JPEGStringToPictureMBS(dbstrng)
// Use the picture