Skip to content

markussammallahti/blurhash-scala

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

blurhash-scala

Scala implementation of blurhash

Usage

build.sbt

resolvers += Resolver.bintrayRepo("mrks", "maven")
libraryDependencies += "mrks" %% "blurhash-scala" % "1.0.0"

Example.scala

import javax.imageio.ImageIO
import java.io.File

import mrks.blurhash.Blurhash

object Example {
  def encode(file: File): String = {
    val image = ImageIO.read(file)
    Blurhash.encode(image, 4, 3)
  }

  def decode(blurhash: String): Either[Blurhash.Error, File] = {
    Blurhash.decode(blurhash, 40, 30).map { image =>
      ImageIO.write(image, "PNG", new File("target.png"))
    }
  }
}

About

Scala implementation of blurhash

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages