Page 1 of 1

Is it possible to get an asset's raw data?

Posted: Sun Sep 19, 2021 4:19 pm
by velocity1029
I need to get the raw data of a token's image so I can convert it to base64 and send that to an API using a REST post.

So, I either need a way to get the raw data of an image from its assetid within a macro, or have some way to get data from local files and access the assetcache folder of maptools to get the raw data into a macro. I'm not sure if the former is possible and as far as I've seen there's not really any way to get data from local files into a macro.

Any ideas would be greatly appreciated!!

Re: Is it possible to get an asset's raw data?

Posted: Sun Sep 19, 2021 4:54 pm
by aliasmask
Not within MapTool. You can use an online tool to get the base64 value of an image. There may be some js libraries online that will allow you to upload a file locally and then give you the base64 values. That still wouldn't have a direct connection to tokens. Maybe do a feature request to update the getAssetProperties function to include base64 data.

Re: Is it possible to get an asset's raw data?

Posted: Sun Sep 19, 2021 5:09 pm
by velocity1029
Sounds good, thanks for the response.