A Kotlin Multiplatform library to use blurhash in your Android App, iOS / Mac App & JVM Backend.
Android |
iOS |
JVM |
---|---|---|
![]() |
![]() |
![]() |
If you've tried using blurhash, you qickly stumple upon the main repository. They provide sources for Swift, Typescript, Python, Kotlin and C. However:
- Implementations produce different hashes for the same picture
- There are no artifacts to consume i.e. no Cocoa Pod or Maven dependency
- Not all implementations provide both encoding and decoding support
- Sample apps for all Android, iOS & JVM with consistent images and blur hashes
The goal of this library is to unify all of the above and provide a common API.
From Kotlin Multiplatform:
kotlin {
sourceSets {
val commonMain by getting {
dependencies {
implementation("com.vanniktech:blurhash:0.1.0")
}
}
}
}
From Android / JVM Multiplatform:
dependencies {
implementation("com.vanniktech:blurhash:0.1.0")
}
From iOS:
pod 'BlurHash', :git => 'https://github.com/vanniktech/blurhash', :branch => "master"
Use com.vanniktech.blurhash.BlurHash
directly in your platform specific code to encode
as well as decode
:
- sample-android: Works with
Bitmap
- sample-ios: Works with
UIImage
(Useimport blurhash
&BlurHash.shared
) - sample-jvm: Works with
BufferedImage
Without them this would not exist!
- woltapp for creating blurbash
- Hendrik Schnepel for the encoding implementation
Copyright (C) 2022 - Niklas Baudy
Licensed under the MIT License