
Ready-to-ship library template automating releases: converts README into homepage, deploys live wasm demo, publishes API docs, builds downloadable sample executables, and wires complete CI/CD.
A high-performance, lightweight image compression library for Compose Multiplatform (Android, iOS, Desktop/JVM, Web/WASM). It allows you to efficiently compress and resize images into high-quality WebP format using a simple, unified multiplatform API.
Key Features:
| Capability | Android | iOS | Desktop (JVM) | Web (WASM) |
|---|---|---|---|---|
| WebP Compression | ✅ | ✅ | ✅ | ✅ |
| Compress By Quality | ✅ | ✅ | ✅ | ✅ |
| Compress By Target Size | ✅ | ✅ (Iterative) | ✅ (Iterative) | ✅ (Iterative) |
| Smart Auto-Resizing | ✅ | ✅ | ✅ | ✅ |
| Compression Analytics | ✅ | ✅ | ✅ | ✅ |
Add the dependency to your Compose Multiplatform project:
Option A — Version Catalog (Recommended)
gradle/libs.versions.toml:[versions]
cmpImgcompress = "0.0.1"
[libraries]
cmp-imgcompress = { module = "io.github.aryapreetam:cmp-imgcompress", version.ref = "cmpImgcompress" }build.gradle.kts:kotlin {
sourceSets {
val commonMain by getting {
dependencies {
implementation(libs.cmp.imgcompress)
}
}
}
}Option B — Direct Dependency
kotlin {
sourceSets {
val commonMain by getting {
dependencies {
implementation("io.github.aryapreetam:cmp-imgcompress:0.0.1")
}
}
}
}import io.github.aryapreetam.cmpimgcompress.*
suspend fun compressMyImage(inputBytes: ByteArray) {
val imageData = ImageData(inputBytes, "image/png")
// Compress to WebP at 80% quality
val compressed: CompressedImage = ImageCompressor.compress(
input = imageData,
config = CompressionConfig.ByQuality(80f)
)
println("Original: ${compressed.originalSize} bytes")
println("Compressed: ${compressed.compressedSize} bytes")
val outputWebpBytes = compressed.bytes
}import io.github.aryapreetam.cmpimgcompress.*
suspend fun compressToLimit(inputBytes: ByteArray) {
val imageData = ImageData(inputBytes, "image/jpeg")
// Attempt to compress the image to fall under 100 KB
val compressed = ImageCompressor.compress(
input = imageData,
config = CompressionConfig.ByTargetSize(100), // Target size limit in KB
resize = ResizeOptions(maxLongEdgePx = 1920) // Optional resizing
)
println("Elapsed time: ${compressed.metadata?.elapsedMillis} ms")
println("Iterations taken: ${compressed.metadata?.iterations}")
}Download and try the sample app on your platform without building from source:
For instructions on how to install and run the pre-built executables or build and run the sample application from source code, please refer to the How to Run the Sample App guide.
MIT License © 2026 aryapreetam and contributors. See LICENSE for details.
A high-performance, lightweight image compression library for Compose Multiplatform (Android, iOS, Desktop/JVM, Web/WASM). It allows you to efficiently compress and resize images into high-quality WebP format using a simple, unified multiplatform API.
Key Features:
| Capability | Android | iOS | Desktop (JVM) | Web (WASM) |
|---|---|---|---|---|
| WebP Compression | ✅ | ✅ | ✅ | ✅ |
| Compress By Quality | ✅ | ✅ | ✅ | ✅ |
| Compress By Target Size | ✅ | ✅ (Iterative) | ✅ (Iterative) | ✅ (Iterative) |
| Smart Auto-Resizing | ✅ | ✅ | ✅ | ✅ |
| Compression Analytics | ✅ | ✅ | ✅ | ✅ |
Add the dependency to your Compose Multiplatform project:
Option A — Version Catalog (Recommended)
gradle/libs.versions.toml:[versions]
cmpImgcompress = "0.0.1"
[libraries]
cmp-imgcompress = { module = "io.github.aryapreetam:cmp-imgcompress", version.ref = "cmpImgcompress" }build.gradle.kts:kotlin {
sourceSets {
val commonMain by getting {
dependencies {
implementation(libs.cmp.imgcompress)
}
}
}
}Option B — Direct Dependency
kotlin {
sourceSets {
val commonMain by getting {
dependencies {
implementation("io.github.aryapreetam:cmp-imgcompress:0.0.1")
}
}
}
}import io.github.aryapreetam.cmpimgcompress.*
suspend fun compressMyImage(inputBytes: ByteArray) {
val imageData = ImageData(inputBytes, "image/png")
// Compress to WebP at 80% quality
val compressed: CompressedImage = ImageCompressor.compress(
input = imageData,
config = CompressionConfig.ByQuality(80f)
)
println("Original: ${compressed.originalSize} bytes")
println("Compressed: ${compressed.compressedSize} bytes")
val outputWebpBytes = compressed.bytes
}import io.github.aryapreetam.cmpimgcompress.*
suspend fun compressToLimit(inputBytes: ByteArray) {
val imageData = ImageData(inputBytes, "image/jpeg")
// Attempt to compress the image to fall under 100 KB
val compressed = ImageCompressor.compress(
input = imageData,
config = CompressionConfig.ByTargetSize(100), // Target size limit in KB
resize = ResizeOptions(maxLongEdgePx = 1920) // Optional resizing
)
println("Elapsed time: ${compressed.metadata?.elapsedMillis} ms")
println("Iterations taken: ${compressed.metadata?.iterations}")
}Download and try the sample app on your platform without building from source:
For instructions on how to install and run the pre-built executables or build and run the sample application from source code, please refer to the How to Run the Sample App guide.
MIT License © 2026 aryapreetam and contributors. See LICENSE for details.