encodeJpeg16

fun encodeJpeg16(bitmap: KiteBitmap16, options: JpegEncodeOptions, metadata: ImageMetadata = ImageMetadata(), cancellationCheck: () -> Unit? = null): ByteArray(source)

Encode bitmap as a JPEG of JpegEncodeOptions.precision bits (#183): a 12-bit DCT file (extended sequential SOF1, progressive SOF2, or their arithmetic forms), or a lossless file of 2 to 16 bits (SOF3, or SOF11 with arithmetic coding). Each sample is the top JpegEncodeOptions.precision bits of its 16-bit value, so a lossless file of a bitmap that decode16 gave from a file of that precision comes back from decode16 the same, and one of 16 bits keeps every sample of any bitmap. One or two channels are gray, three or four RGB; alpha is discarded. An 8-bit precision writes what encodeJpeg writes of the high bytes.

metadata and cancellationCheck work as in encodeJpeg.

Throws

if a side of bitmap is larger than 65535, or if a lossless restart interval does not hold whole rows