Can I replace the image on a widget at runtime? If so, how?

I’d like to load a file at runtime, chop it up into squares, and put each of the squares into an image in its own widget. I think that when I chop up a bitmap I will end up with a material, so I’m trying to use the brush on an image and use that to put the picture from the material into an image.

However, when I call the method, I’m not getting any picture in the image. What is the right way to set a material onto an image at runtime?

I am not 100% sure, but:
In blueprints:
Create a material
Create a dynamitc material instance
Set brush from material
Set brush from material node to appy the material

By load file at runtime you mean load from disc?

If so i tried it about year ago, there are functions in C++, however they are low level and i kind of could not find documentation of formats they use (like format and settings to properly load for eg TGA file).

Also there was some problems with invalid pointers (and usual result crashing to desktop).

Thanks, Nawrot!

I was able to load the file in C++ following the approach here: Creating a File Picker | Orfeas Eleftheriou.

I could presumably write more C++ code to parse the incoming file into square bitmaps, but I thought it might be cleaner to do in blueprints instead. (I might need one lib for PNG, another one for TIFF, and yet another one for JPG)

I am thinking that in theory once I have the bitmap loaded I can use a dynamic material to grab the square that I want from the bitmap, and pass that along to an image in a widget for display onscreen.

However, when I try to apply a material to an image on my widget, nothing seems to be happening - Set Brush Resource To Material seems to not be working for me.

Here is the layout of the widget, it has only one child, the image:

Did I call SetBrushResourceToMaterial correctly?

Thanks KingOfChaos! I tried using CreateDynamicdMaterialInstance, but I still get an empty material, even though the print statement gives me a name of a material. Any ideas?