1

I've been looking into Scala/Java based image compression and optimisation libraries and https://github.com/sksamuel/scrimage looked like a good choice until I found that the documentation was incorrect and got no support whatsoever from their Gitter channel.

Here's my build.sbt line for the dependency;

libraryDependencies += "com.sksamuel.scrimage" %% "scrimage-core" % "2.1.1"

and the examples on the documentation show; https://github.com/sksamuel/scrimage/blame/master/README.md#L88

Which seems to be incorrect since I have no writer method in the Image class. Is the library no longer supported? Has anyone found workarounds for this?

Ashesh
  • 2,978
  • 4
  • 27
  • 47

1 Answers1

2

Here is a simple example on how to read/write.

  // bring in a writer into scope for later
  implicit val writer = PngWriter.NoCompression

  // the image.fromFile method will work out what the file type is, the ext is optional really
  val image = Image.fromFile(new File("input.jpeg"))

  // just playing about the with image. They are immutable.
  val modified = image.scale(2).brightness(1.2).flipY

  // output accepts a file, path, string etc and requires an implicit writer.
  val out = modified.output(new File("output.png"))
sksamuel
  • 16,154
  • 8
  • 60
  • 108