Hello guys. I want to screenshot but also with SetMaskEnabled but I don’t know why the saved image has the background green.
If I use TakeHighResScreenshot BP it’s working, but in C++ I have a green bg.
void AJsonActor::SavePic()
{
FString Folder = TEXT("F:/img/");
FString PNGExtension = TEXT(".png");
FString Path = Folder.Append(ZombieType).Append(PNGExtension);
UGameViewportClient * GameViewport = GEngine->GameViewport;
if(GameViewport)
{
FHighResScreenshotConfig &HighResScreenshotConfig = GetHighResScreenshotConfig();
FViewport *Viewport = GameViewport->Viewport;
if(Viewport)
{
HighResScreenshotConfig.SetFilename(Path);
HighResScreenshotConfig.SetMaskEnabled(true);
HighResScreenshotConfig.SetHDRCapture(true);
GScreenshotResolutionX = 2048.0f;
GScreenshotResolutionY = 2048.0f;
// GetHighResScreenshotConfig().SetFilename(Path);
Viewport->TakeHighResScreenShot();
}
}
}