Scala library for image creation

邮差的信 提交于 2019-12-21 21:27:26

问题


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?


回答1:


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.




回答2:


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

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




回答3:


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.




回答4:


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




回答5:


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.



来源:https://stackoverflow.com/questions/12887428/scala-library-for-image-creation

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