How to load an image using a formula

Hi,

I have a feature image that is used to derive colours for the rest of my theme using bp commands. I want the feature image to change based on the wi(icon).

I know I could do this by defining all the images as separate image globals, but this makes it difficult and tedious to add/change them.

What I'd like to do is define a JSON with all the images mapped to the wi(icon) types. I can then use the wg command to load the properties of the JSON.

However, the difficulty here is that I don't know how to go from a JSON result (string probably) to an image that KLWP will accept. None of the functions seem to give images as output. I expect a file path wouldn't work; perhaps a shell script? Maybe this is impossible?

Thanks in advance for the help.