3

Is there any good Scala or Java library for image manipulation? For simple tasks like composing an image with some others then generating a thumb?

Johnny Everson
  • 8,343
  • 7
  • 39
  • 75

5 Answers5

4

Take a look at https://github.com/sksamuel/scrimage (Disclaimer: I am the author)

This is an open source Scala image library that essentially wraps java.awt Image operations in a nicer API.

You asked how to generate a thumbnail, you would do something like.

val in = ...// some input stream 
val out = ... // some output stream
Image(in).scale(300,400).write(out, Png)

You can change the scaling method (Bicubic by default) and the output format.

sksamuel
  • 16,154
  • 8
  • 60
  • 108
2

It's not Scala-specific, but ImgLib2 is a full-powered Java image processing library. It's geared towards scientific/low level use, so it might not be as easy as you want for what you're looking for, but it can almost certainly manage anything you're likely to want.

Rex Kerr
  • 166,841
  • 26
  • 322
  • 407
2

they're all a bit old school, and maybe inconvenient, but java.awt, java.awt.image, and javax.imageio has everything you need to blend and rescale images. You can find some blending example code e.g. here

http://www.curious-creature.org/2006/09/20/new-blendings-modes-for-java2d/

you can find some examples of rescaling and generating image bytes e.g. here

https://sourceforge.net/projects/ssim/?source=directory

there are probably newer/easier solutions, but these do work.

Steve Waldman
  • 13,689
  • 1
  • 35
  • 45
2

There are also a lot of nice image filters in this Open Source library:

http://www.jhlabs.com/ip/filters/

0__
  • 66,707
  • 21
  • 171
  • 266
1

Since the question is tag with java-2d you know you can use any Java library. A quick google revealed this SO answer:

open source image processing lib in java

Community
  • 1
  • 1
pedrofurla
  • 12,763
  • 1
  • 38
  • 49