Screenshot without background for HTML5

Hi. I have a question about the screenshot library.

GitHub - britzl/defold-screenshot: Screenshot extension for the Defold game engine · GitHub

I’m trying to use it to capture a part of the screen but without the background, then save the image so that I can later use it as a texture when loading the players screenshots. This works just fine on the simulator by setting the render clear color alpha to 0.

However, when I run the HTML5 build, it still includes the background in the resulting png. Does anyone know why that could be? Is there any way to take a backgroundless screenshot for HTML5?

The HTML5 version uses a slightly different approach and creates an offscreen canvas to which it renders the entire screen and then saves the bytes:

It might be possible to modify this bit to get the result you want, but I’m not entirely sure where to start.

1 Like

I see. Seems like this is going to be a little more complicated than I thought. I might just settle for what I have now and revisit this later. Thanks!

1 Like