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
Functions
Link copied to clipboard
Link copied to clipboard
expect fun ByteArray.compressImage(options: ImageCompressionOptions = ImageCompressionOptions()): ByteArray
Compresses this ByteArray if it contains a supported image.
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
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
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Opens the platform's image picker and returns the selected ImageData, or null if the user cancels the selection. The image isn't loaded in the memory in its actual size, it's downsampled according to the current window size of the app and then loaded into memory as ImageData which is lower than the actual size eliminating the possibility of OutOfMemoryError
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun ImageBitmap.withAspectRatio(aspectRatio: Float, scale: Boolean = false, targetHeight: Int? = null): ImageBitmap
Adjusts this ImageBitmap to a target aspect ratio.