decodePage

fun decodePage(data: ByteArray, page: Int, applyOrientation: Boolean = false, colorTarget: ColorTarget = ColorTarget.Source, cancellationCheck: () -> Unit? = null): KiteBitmap(source)

Decode page page of data, counting from 0. A TIFF has a page for each image file directory in its main chain, as libtiff, ImageIO and libvips count them, and decode gives the first; ImageInfo.pageCount says how many there are. A HEIC or AVIF file has a page for each top-level image, the primary first, so the two eyes of a spatial photo are pages 0 and 1, as ImageInfo.stereoLeftPage and ImageInfo.stereoRightPage say. Every other format has one page. Pages are separate images with their own size, depth and orientation, not animation frames, so decodeAnimation gives a TIFF's first page alone.

With applyOrientation the page's own orientation tag is honoured, as decode does for the first, and colorTarget converts as for decode.

Throws

on malformed/truncated input or unknown format

on formats or features recognised but not yet decodable

if page is negative or the file has no such page