Skip to main content

C_ImageProcessing

High-level API for dealing with common image formats

Status

Experimental: Functionality may change for any reason, without semantic versioning guarantees

Availability

This is a global namespace and can be accessed directly:

C_ImageProcessing.DecodeFileContents(imageFileContents) -- Implicit global lookup: _G.C_ImageProcessing

Functions

DecodeFileContents

Decodes the given imageFileContents and returns the raw pixel data in RGBA format, as well as the image dimensions. Any file format that's supported by stbi_image can be decoded. This includes at least the following: BMP, PNG, JPG, TGA.

Available since: v0.0.9
Arguments
#NameTypeFallback
imageFileContentsstring
Return values
#NameType
rgbaPixelArraytable
imageWidthInPixelsnumber
imageHeightInPixelsnumber

EncodeBMP

Encodes the given rgbaPixelArray as a BMP image of the provided dimensions.

Available since: v0.0.9
Arguments
#NameTypeFallback
rgbaPixelArraytable
imageWidthInPixelsnumber
imageHeightInPixelsnumber
Return values
#NameType
bmpFileContentsstring

EncodePNG

Encodes the given rgbaPixelArray as a PNG image of the provided dimensions, without padding (zero-length stride).

Available since: v0.0.9
Arguments
#NameTypeFallback
rgbaPixelArraytable
imageWidthInPixelsnumber
imageHeightInPixelsnumber
Return values
#NameType
pngFileContentsstring

EncodeJPG

Encodes the given rgbaPixelArray as a JPEG image of the provided dimensions, using the highest quality setting (100%).

Available since: v0.0.9
Arguments
#NameTypeFallback
rgbaPixelArraytable
imageWidthInPixelsnumber
imageHeightInPixelsnumber
Return values
#NameType
jpegFileContentsstring

EncodeTGA

Encodes the given rgbaPixelArray as a TGA image of the provided dimensions.

Available since: v0.0.10
Arguments
#NameTypeFallback
rgbaPixelArraytable
imageWidthInPixelsnumber
imageHeightInPixelsnumber
Return values
#NameType
tgaFileContentsstring

Changelog

VersionWhat happened?
v0.0.10Added EncodeTGA
v0.0.9Initial release