# UTextureRenderTarget2D to PNG

**URL:** <https://forums.unrealengine.com/t/utexturerendertarget2d-to-png/411024>\
**Category:** Rendering\
**Tags:** rendertarget, png, images, unreal-engine, CPP, question\
**Created:** [November 30, 2017, 6:57pm UTC](https://forums.unrealengine.com/t/utexturerendertarget2d-to-png/411024 "2017-11-30T18:57:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![RDaneelOlivaw](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RDaneelOlivaw](https://forums.unrealengine.com/u/RDaneelOlivaw)\
**Post date:** [November 30, 2017, 6:57pm UTC](https://forums.unrealengine.com/t/utexturerendertarget2d-to-png/411024/1 "2017-11-30T18:57:40Z")

</div>

Hi,  
I’ve been trying to make this work for the past two days and I it seems to me that something is not right  
I’m trying to retrieve camera images from UE4.17.2 and save them into a PNG.

I have added to my ActorBlueprint a `SceneCaptureComponent2D` that is linked to a `TextureTarget`that I’ve also created. Is there a configuration that ahs to be done. Because the Little Icon of the TextureTarget Asset renders correctly and you can see what it should be seen

I’ve followed:

> **[How to extract a Texture2D from a render target?](https://forums.unrealengine.com/questions/534863/how-to-extract-a-texture2d-from-a-render-target.html)**
>
> Hey, Through many attempts and hours I have been trying to convert a render target to a texture 2d. I believe the closest I have come is converting the render target to a slate brush and attempting to get it out with the "Get brush resource as...

> **[Accessing camera images](https://forums.unrealengine.com/questions/486630/accessing-camera-images.html)**
>
> Hello everybody, Does anyone know a way to programmatically access the images rendered by a camera ? I do not want to change the player's viewport or influence the environment in any kind. The only thing I need is an object (camera) to place...

> **[Proper way to convert from UTextureRenderTarget2D into UTexture2D?](https://forums.unrealengine.com/questions/604569/proper-way-to-convert-from-utexturerendertarget2d.html)**
>
> Hello, I want to convert a captured screen of game into UTexture2D. Here’s what has been done. I have inherited a custom class AScreenCapture2D from ASceneCapture2D, with member UPROPERTY() UTexture2D\* m\_photo; and added these functions. ...

But none of them seem to work. The images Appear either empty or totally black.  
The FColour vectors generated are just totally black or white.

Could someone give a complete full example of how this should be accomplished because it seems that there is a lot of confusion on how this should be done and there is no full working example out there that I have found. Something like: create this blueprint actor with this and this, and create in its cutsom C++ class such and such functions that retrieves the This camera in this actor and saves it into a png.

It would help a lot to the UE4 comunity no doubt about it.

---

<div class="post-metadata">

**Author:** ![Kung\_Fu\_Donkey](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Kung\_Fu\_Donkey](https://forums.unrealengine.com/u/Kung_Fu_Donkey)\
**Post date:** [August 24, 2022, 12:43pm UTC](https://forums.unrealengine.com/t/utexturerendertarget2d-to-png/411024/2 "2022-08-24T12:43:03Z")

</div>

So this is a late reply, but for anyone still looking here is the answer. For some reason currently in 5.0.3 the alpha value of the picture in bgra is set to 0 for every pixel. So the way to fix this is by setting the alpha for every pixel to 255.
