LlamaImage

sealed class LlamaImage(source)

An image attached to a multimodal prompt (LlamaEngine.generate with images). Images live in memory only: the bytes are handed to libmtmd zero-copy (pinned for the duration of tokenization, never copied by Kotlin, never written to a temporary file) and must not be modified until the generate collection has started evaluating.

Inheritors

Types

Link copied to clipboard
class Encoded(val bytes: ByteArray) : LlamaImage

An encoded image file — PNG, JPEG, BMP, GIF (first frame), TGA, PSD, HDR, PIC or PNM, as decoded by libmtmd's bundled stb_image — decoded in memory.

Link copied to clipboard
class Rgb(val width: Int, val height: Int, val pixels: ByteArray) : LlamaImage

Raw packed RGB888 pixels, row by row from the top-left: width * height * 3 bytes.