How to let player draw on widget and save image?

You want to be using render targets for this. You should watch Epic’s training stream to get a basic idea of how to set up blueprint render targets Blueprint Drawing to Render Targets Overview | Live Training | Unreal Engine - YouTube

As for saving / loading the render targets, that’s a little bit more complicated. There isn’t any out of the box functionality that I’m aware of to do this, so I’ve had to piece together my own solution in C++. The basic idea is that you want to read the pixels from the render target and write them to disk. You can then initialize a new render target with this saved data at a later time.

Skip to the bottom and look at the AHeightMapReader::UpdateBuffer() method in his code. Also take note of the “non blocking update buffer” method used beneath this. Reading pixels from a render target is a fairly expensive operation, and I personally found this solution to be quite necessary!

In my own implementation I am writing the pixels to my saved game object. To load my render target I then grab the pixels in my saved game object and initialize a new Texture Object from these pixels (see FImageUtils::CreateTexture2D()) One thing to be aware of when using this method is that it does contain editor only code, so you’ll probably want to have a look at Rama’s alternative version of this function which you can find here. https://answers.unrealengine.com/questions/33571/fimageutilscreatetexture2d-causes-brief-hang-is-th.html

Once you have a Texture2D that you’ve created from the saved render target data the rest is easy! You can just draw it to a fresh render target!

something like this:

UKismetRenderingLibrary::BeginDrawCanvasToRenderTarget(this, NewRT, RTCanvas, DrawSize, RTDrawContext);

RTCanvas->K2_DrawTexture(SavedRTTexture, FVector2D::ZeroVector, FVector2D(RTSize, RTSize), FVector2D::ZeroVector, FVector2D::UnitVector, FLinearColor(1.f, 1.f, 1.f, 1.f), EBlendMode::BLEND_Translucent);

UKismetRenderingLibrary::EndDrawCanvasToRenderTarget(this, RTDrawContext);

I hope all of that made some sense. Apologies if not, I’m still figuring it all out myself :slight_smile: It would surely be nice if Epic provided some better tools for handling render targets inside blueprint!