LoadImage method supports loading from blob

dopus.loadimage(Blob)

When would you need this?

The pictures on the WeChat PC are XOR encrypted, and I want to display them after decryption for screening.

That makes sense.

But why not write the data to a temp-file, call LoadImage on that file, then delete the file?

Something like this (not tested):

function LoadImageFromBlob(blob, control)
{
	var fso = new ActiveXObject("Scripting.FileSystemObject");
	var fsu = DOpus.FSUtil;

	var tempPath = fso.BuildPath(fso.GetSpecialFolder(2), fso.GetTempName()); // TemporaryFolder = 2
	
	var file = fsu.OpenFile(tempPath, "wa");
	if (file.error != 0)
		return false;
	file.Write(blob);
	file.Close();

	var image = DOpus.LoadImage(tempPath); // Returns false if it fails.
	fso.DeleteFile(tempPath);
	return image;
}
1 Like

In the next update DOpus.LoadImage will accept a Blob.

This is available now in 12.23.1 Beta.