Image

An Image stores raw 2D pixel info for Textures. It has a width, height, and format. The Image can be initialized with the contents of an image file or it can be created with uninitialized contents. The supported image formats are png, jpg, hdr, dds, ktx, and astc.

Usually you can just use Textures, but Image can be useful if you want to manipulate individual pixels, load Textures in a background thread, or use the FFI to efficiently access the raw image data.

Constructors

lovr.data.newImageCreate a new Image.
Canvas:newImageCreate a new Image from a Canvas texture.

Methods

Image:getBlobGet the bytes backing this Image as a `Blob`.
Image:getDimensionsGet the dimensions of the Image.
Image:encodeEncode the Image as png.
Image:getFormatGet the pixel format of the Image.
Image:getHeightGet the height of the Image.
Image:pasteCopy pixels from another Image to this one.
Image:getPixelGet the value of a pixel of the Image.
Image:setPixelSet the value of a pixel of the Image.
Image:getWidthGet the width of the Image.

See also