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

**URL:** <https://forums.unrealengine.com/t/can-i-replace-the-image-on-a-widget-at-runtime-if-so-how/2310710>\
**Category:** Blueprint\
**Tags:** unreal-engine\
**Created:** [January 30, 2025, 6:11pm UTC](https://forums.unrealengine.com/t/can-i-replace-the-image-on-a-widget-at-runtime-if-so-how/2310710 "2025-01-30T18:11:18Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![petewil0](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@petewil0](https://forums.unrealengine.com/u/petewil0)\
**Post date:** [January 30, 2025, 6:11pm UTC](https://forums.unrealengine.com/t/can-i-replace-the-image-on-a-widget-at-runtime-if-so-how/2310710/1 "2025-01-30T18:11:18Z")

</div>

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.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/d/d/cdd601655f248edb40e459dbae3e06acf4ad6441.png)

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?**

---

<div class="post-metadata">

**Author:** ![King0fChaos](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@King0fChaos](https://forums.unrealengine.com/u/King0fChaos)\
**Post date:** [January 30, 2025, 8:06pm UTC](https://forums.unrealengine.com/t/can-i-replace-the-image-on-a-widget-at-runtime-if-so-how/2310710/2 "2025-01-30T20:06:21Z")

</div>

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

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/d/8/9d89ba23c1c874661dd543e21714d76f3929badf.png)

---

<div class="post-metadata">

**Author:** ![Nawrot](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/nawrot/32/618260_2.png) [@Nawrot](https://forums.unrealengine.com/u/Nawrot)\
**Post date:** [January 30, 2025, 10:14pm UTC](https://forums.unrealengine.com/t/can-i-replace-the-image-on-a-widget-at-runtime-if-so-how/2310710/3 "2025-01-30T22:14:42Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![petewil0](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@petewil0](https://forums.unrealengine.com/u/petewil0)\
**Post date:** [February 4, 2025, 5:03pm UTC](https://forums.unrealengine.com/t/can-i-replace-the-image-on-a-widget-at-runtime-if-so-how/2310710/4 "2025-02-04T17:03:00Z")

</div>

Thanks, Nawrot!

I was able to load the file in C++ following the approach here: [Creating a File Picker | Orfeas Eleftheriou](https://www.orfeasel.com/creating-a-file-picker/).

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:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/1/9/a1955552ab2d53ca774c4835e955f56c431b8214.png)

Did I call SetBrushResourceToMaterial correctly?

---

<div class="post-metadata">

**Author:** ![petewil0](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@petewil0](https://forums.unrealengine.com/u/petewil0)\
**Post date:** [February 4, 2025, 5:24pm UTC](https://forums.unrealengine.com/t/can-i-replace-the-image-on-a-widget-at-runtime-if-so-how/2310710/5 "2025-02-04T17:24:02Z")

</div>

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?

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/2/1/021d60892332a5201b49a92e2f8842b623797675.png)

---

<div class="post-metadata">

**Author:** ![petewil0](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@petewil0](https://forums.unrealengine.com/u/petewil0)\
**Post date:** [February 19, 2025, 10:33pm UTC](https://forums.unrealengine.com/t/can-i-replace-the-image-on-a-widget-at-runtime-if-so-how/2310710/6 "2025-02-19T22:33:17Z")

</div>

I never found an answer for this, so my intent is to redo my widget as an actor with a mesh and use that instead.

---

<div class="post-metadata">

**Author:** ![ImYourBeast](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/imyourbeast/32/1220194_2.png) [@ImYourBeast](https://forums.unrealengine.com/u/ImYourBeast)\
**Post date:** [November 20, 2026, 2:34pm UTC](https://forums.unrealengine.com/t/can-i-replace-the-image-on-a-widget-at-runtime-if-so-how/2310710/7 "2026-11-20T14:34:20Z")

</div>

Load the image to a texture first, then use Set Brush From Texture on the Image widget. Test with the texture directly first so you know the load worked before you add the crop logic.  
you can also try Runtime Directory Watcher, it loads image files as textures async for runtime widget use: [Runtime Directory Watcher — Hot-Folder File Events & Async Texture Loader | Fab](https://www.fab.com/listings/98c9d662-202c-4e78-aeb7-dbf52e7d6935)
