Lua bindings to the QOI (“Quite OK Image”) library (https://github.com/phoboslab/qoi)
local qoi = require "lua-qoi"
local image = qoi.read("hello.qoi")
local x, y = image.width / 2, image.height / 2
image:setPixel(x, y, 255, 255, 255)
image:write("world.qoi")
See more examples in the test directory.
Reads a QOI image from the given path. The channels argument is optional and defaults to 0, meaning the channels from the file are used.
Creates a new QOI image with the given dimensions. The channels
parameter is optional and defaults to 4.
Decodes a QOI image from a binary string.
Writes a QOI image to the given path.
Encodes a QOI image to a binary string.
Returns the pixel at the given coordinates. The returned values are in the range [0, 255].
Sets the pixel at the given coordinates. The values must be in the range [0, 255]. The a
parameter is optional and defaults to 255.
Image width.
Image height.
Image channels.
To build this library, run:
$ build.bat
For building for a specific Lua version, change
find_package(Lua 5.1 EXACT REQUIRED)
to what you need in CMakeLists.txt. For example,find_package(Lua 5.3 EXACT REQUIRED)
for Lua 5.3.
To test this library, run:
$ cd test
$ lua all.lua
This library has been tested with Lua 5.1, 5.3 and 5.4.
This library is released under the MIT license.