Skip to content

BlurHash support for iOS, Android and JVM via Kotlin Multiplatform

License

Notifications You must be signed in to change notification settings

vanniktech/blurhash

Repository files navigation

blurhash

A Kotlin Multiplatform library to use blurhash in your Android App, iOS / Mac App & JVM Backend.

Android iOS JVM
Sample Android Sample iOS Sample JVM

Why?

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
  • Missing sample apps with consistent images and blur hashes

The goal of this library is to solve all of the above mentioned problems, provide a common API and good samples for each platform.

Usage

From Kotlin Multiplatform:

kotlin {
  sourceSets {
    val commonMain by getting {
      dependencies {
        implementation("com.vanniktech:blurhash:0.4.0-SNAPSHOT")
      }
    }
  }
}

From Android / JVM Multiplatform:

dependencies {
  implementation("com.vanniktech:blurhash:0.4.0-SNAPSHOT")
}

From iOS:

pod 'BlurHash', :git => 'https://github.com/vanniktech/blurhash', :tag => "0.4.0-SNAPSHOT"

API

Use com.vanniktech.blurhash.BlurHash directly in your platform specific code to encode as well as decode:

Thanks

Without them this would not exist!

License

Copyright (C) 2022 - Niklas Baudy

Licensed under the MIT License