Scala library for image creation

落花浮王杯 提交于 2019-12-04 14:53:58

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.

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

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

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.

pedrofurla

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

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.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!