encodeJxr

fun encodeJxr(bitmap: KiteBitmap, quality: Int = 90): ByteArray(source)

Encode bitmap as a lossy JPEG XR file (#181) at quality 0..100 (default 90), which means what JxrEncApp -q means at quality divided by 100: YUV 4:4:4 and one level of overlap filtering from 50 up, 4:2:0 and two levels below. A gray opaque bitmap is written as 8bppGray, an opaque one as 24bppBGR, and one with alpha as 32bppBGRA with planar alpha, coded losslessly.

Throws

if quality is outside 0..100, or bitmap has more than 2^28 pixels


fun encodeJxr(bitmap: KiteBitmap, options: JxrEncodeOptions, metadata: ImageMetadata = ImageMetadata(), cancellationCheck: () -> Unit? = null): ByteArray(source)

Encode bitmap as a JPEG XR file (#181) with every setting of options: lossless or at a quality, 4:4:4 or 4:2:0 chroma, the overlap mode, quantizers per channel and per tile, tiles, spatial or frequency order, and planar or interleaved alpha. The ICC profile, XMP packet and EXIF block of metadata go into the file's directory, the EXIF orientation as its Transformation tag; a ImageMetadata.gainMap is left out. cancellationCheck runs before each row of macroblocks of each codestream and may throw to stop the encode.

Throws

if bitmap has more than 2^28 pixels, or options asks for tiles the image does not have