Package-level declarations

Types

Link copied to clipboard

Output format used during compression.

Link copied to clipboard
data class ImageCompressionOptions(val format: ImageCompressionFormat = ImageCompressionFormat.JPEG, val quality: Int = 90, val maxBytes: Long? = null, val minQuality: Int = 55, val qualityStep: Int = 5)

Options that control image compression.

Link copied to clipboard
data class ImageData(val bytes: ByteArray?)

A container class representing a loaded image.

Functions

Link copied to clipboard
fun ImageData.compress(options: ImageCompressionOptions = ImageCompressionOptions()): ImageData

Returns a compressed copy of this ImageData.

Link copied to clipboard
expect fun ByteArray.compressImage(options: ImageCompressionOptions = ImageCompressionOptions()): ByteArray

Compresses this ByteArray if it contains a supported image.

actual fun ByteArray.compressImage(options: ImageCompressionOptions): ByteArray
Link copied to clipboard
fun ImageData.compressToMaxBytes(maxBytes: Long, format: ImageCompressionFormat = ImageCompressionFormat.JPEG, quality: Int = 90, minQuality: Int = 55, qualityStep: Int = 5): ImageData

Compresses this ImageData toward the provided maximum size.

fun ByteArray.compressToMaxBytes(maxBytes: Long, format: ImageCompressionFormat = ImageCompressionFormat.JPEG, quality: Int = 90, minQuality: Int = 55, qualityStep: Int = 5): ByteArray

Compresses this ByteArray toward the provided maximum size.

Link copied to clipboard
actual suspend fun ByteArray.downSamplingToImageBitmap(coroutineScope: CoroutineScope, reqHeight: Int, reqWidth: Int): ImageBitmap?
expect suspend fun ByteArray.downSamplingToImageBitmap(coroutineScope: CoroutineScope, reqHeight: Int, reqWidth: Int): ImageBitmap?

Returns a bitmap with down sampling for the current screen size.

actual suspend fun ByteArray.downSamplingToImageBitmap(coroutineScope: CoroutineScope, reqHeight: Int, reqWidth: Int): ImageBitmap?
actual suspend fun ByteArray.downSamplingToImageBitmap(coroutineScope: CoroutineScope, reqHeight: Int, reqWidth: Int): ImageBitmap?
Link copied to clipboard
actual suspend fun selectImage(): ImageData?
expect suspend fun selectImage(): ImageData?

Opens the platform's image picker and returns the selected ImageData, or null if the user cancels the selection.

actual suspend fun selectImage(): ImageData?
actual suspend fun selectImage(): ImageData?
Link copied to clipboard
Link copied to clipboard

Converts this ImageBitmap into a ByteArray

Link copied to clipboard

Converts this ByteArray into an ImageBitmap.

Link copied to clipboard
fun ImageBitmap.withAspectRatio(aspectRatio: Float, scale: Boolean = false, targetHeight: Int? = null): ImageBitmap

Adjusts this ImageBitmap to a target aspect ratio.