
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:
adb install sample-app-android-unsigned.apksample-app-wasm.zip
index.html in your web browser.sample-app-ios-simulator.zip
sample-app-ios-simulator.app
.app onto the Simulator window, or run:
xcrun simctl install booted /path/to/sample-app-ios-simulator.appDownload the DMG for your architecture (Intel/x64 or Apple Silicon/arm64).
Open the DMG and drag the app to your Applications folder.
When you try to open the app for the first time, macOS Gatekeeper will block it since it is an open-source build signed ad-hoc. Follow these 6 sequential steps to allow running the app:
1. Block Alert Dialog
|
2. Open System Settings
|
3. Privacy & Security Section
|
4. Click "Open Anyway"
|
5. Authenticate Security Dialog
|
6. Click "Open" to Launch
|
Summary:
.deb package.sudo dpkg -i sample-app-linux.debTo run the sample app locally on your machine:
./gradlew :sample:composeApp:run
:sample:androidApp run configuration in Android Studio.sample/iosApp/iosApp.xcodeproj in Xcode and run it../gradlew :sample:composeApp:wasmJsBrowserRun
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:
adb install sample-app-android-unsigned.apksample-app-wasm.zip
index.html in your web browser.sample-app-ios-simulator.zip
sample-app-ios-simulator.app
.app onto the Simulator window, or run:
xcrun simctl install booted /path/to/sample-app-ios-simulator.appDownload the DMG for your architecture (Intel/x64 or Apple Silicon/arm64).
Open the DMG and drag the app to your Applications folder.
When you try to open the app for the first time, macOS Gatekeeper will block it since it is an open-source build signed ad-hoc. Follow these 6 sequential steps to allow running the app:
1. Block Alert Dialog
|
2. Open System Settings
|
3. Privacy & Security Section
|
4. Click "Open Anyway"
|
5. Authenticate Security Dialog
|
6. Click "Open" to Launch
|
Summary:
.deb package.sudo dpkg -i sample-app-linux.debTo run the sample app locally on your machine:
./gradlew :sample:composeApp:run
:sample:androidApp run configuration in Android Studio.sample/iosApp/iosApp.xcodeproj in Xcode and run it../gradlew :sample:composeApp:wasmJsBrowserRun
MIT License © 2026 aryapreetam and contributors. See LICENSE for details.