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

TypeNameDescription
core.texture.texel_formatformatTarget pixel format

Returns

TypeNameDescription
boolstatustrue on successful execution, false otherwise

Examples

Reduce VRAM by converting to RGB565
local entity = core.texture.create("assets/background.png")

entity:convert(core.texture.texel_format.RGB565)
Convert to RGBA4444 for a low-quality mode
local entity = core.texture.create("assets/sprite.png")

entity:convert(core.texture.texel_format.RGBA4444)
Convert a grayscale mask to L8
local entity = core.texture.create("assets/mask.png")

entity:convert(core.texture.texel_format.L8)

On this page