Image
EditAn 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.
Constructor
| lovr.data.newImage | Create a new Image. |
Methods
| Image:encode | Encode the Image as png. |
| Image:getBlob | Get the bytes backing this Image as a `Blob`. |
| Image:getDimensions | Get the dimensions of the Image. |
| Image:getFormat | Get the pixel format of the Image. |
| Image:getHeight | Get the height of the Image. |
| Image:getPixel | Get the value of a pixel of the Image. |
| Image:getPointer | Get a raw pointer to the Image pixel data. |
| Image:getWidth | Get the width of the Image. |
| Image:mapPixel | Transform an Image by applying a function to every pixel. |
| Image:paste | Copy pixels from another Image to this one. |
| Image:setPixel | Set the value of a pixel of the Image. |
| Object:release | Immediately release the Lua reference to an object. |
| Object:type | Get the type name of the object. |