Gets an existing texture frame and converts it into a base64 encoded image and returns the base64 data.
You can also provide the image type and encoder options.
This will only work with bitmap based texture frames, such as those created from Texture Atlases. It will not work with GL Texture objects, such as Shaders, or Render Textures. For those please see the WebGL Snapshot function instead.
name | type | arguments | Default | description |
---|---|---|---|---|
key | string |
The unique string-based key of the Texture. |
||
frame | string | number | <optional> |
The string-based name, or integer based index, of the Frame to get from the Texture. |
|
type | string | <optional> | 'image/png' |
A DOMString indicating the image format. The default format type is image/png. |
encoderOptions | number | <optional> | 0.92 |
A Number between 0 and 1 indicating the image quality to use for image formats that use lossy compression such as image/jpeg and image/webp. If this argument is anything else, the default value for image quality is used. The default value is 0.92. Other arguments are ignored. |
The base64 encoded data, or an empty string if the texture frame could not be found.