Companion

object Companion

Functions

Link copied to clipboard
fun gray(pixels: ByteArray, width: Int, height: Int): PdfImage

8-bit grayscale, 1 byte per pixel. No transparency.

Link copied to clipboard
fun jpeg(jpegBytes: ByteArray, width: Int, height: Int, grayscale: Boolean = false): PdfImage

Embed encoded JPEG bytes directly via /DCTDecode (no re-encode). width/height must match the JPEG's own dimensions. Set grayscale for a single-component (DeviceGray) JPEG.

Link copied to clipboard
fun rgb(pixels: ByteArray, width: Int, height: Int): PdfImage

8-bit RGB, 3 bytes per pixel (R,G,B). No transparency.

Link copied to clipboard
fun rgba(pixels: ByteArray, width: Int, height: Int): PdfImage

8-bit RGBA, 4 bytes per pixel (R,G,B,A). The alpha channel becomes a /SMask; if every pixel is fully opaque the mask is omitted.