How do I get the the size in bytes of an image in memory? Im trying to encode it as a string. In desperation I tried using SAVEIMAGE to the temp directory and using FILESIZE to get the image size, but this resulted in a new problem where SAVEIMAGE is not creating the PNG, not sure why this isn't working. But if I can avoid doing this even better.
Code: Select all
Procedure.s encodePNG(image.i)
fileName.s = GetTemporaryDirectory()+"temp.png"
If SaveImage(image,fileName,#PB_ImagePlugin_PNG)
size.i = FileSize(fileName)
encoded.s = Base64Encoder(image, size)
ProcedureReturn encoded
Else
Debug "Save error"
EndIf
EndProcedure