self:convert
Client
Converts the texture to a different pixel format, reducing VRAM by lowering color depth or channel count
Syntax
local status = self:convert(
format
)Converting changes pixel format only — the texture stays uncompressed in VRAM. Unlike self:compress, it doesn't use GPU block-compression, so it can be converted again — or compressed later — at any time.
- Use
convert— for quick, reversible VRAM savings, or a specific channel layout. - Use
compress— for maximum VRAM savings on a finished asset that won't need further format changes. - Combining both — convert first if you need a specific format, then compress; compression locks the texture afterward.
Parameters
| Type | Name | Description |
|---|---|---|
core.texture.texel_format | format | Target pixel format |
Returns
| Type | Name | Description |
|---|---|---|
bool | status | true on successful execution, false otherwise |
Examples
local entity = core.texture.create("assets/background.png")
entity:convert(core.texture.texel_format.RGB565)local entity = core.texture.create("assets/sprite.png")
entity:convert(core.texture.texel_format.RGBA4444)local entity = core.texture.create("assets/mask.png")
entity:convert(core.texture.texel_format.L8)