我同时使用 JAI 媒体 API 和 ImageMagick?
ImageMagick 有一些可扩展性问题,基于 JNI 的 JMagick 也没有吸引力。与 ImageMagick 相比,JAI 在调整大小操作时质量较差。
有谁知道任何优秀的工具,无论是开源的还是商业的,都是原生 java 并提供高质量的结果?
我同时使用 JAI 媒体 API 和 ImageMagick?
ImageMagick 有一些可扩展性问题,基于 JNI 的 JMagick 也没有吸引力。与 ImageMagick 相比,JAI 在调整大小操作时质量较差。
有谁知道任何优秀的工具,无论是开源的还是商业的,都是原生 java 并提供高质量的结果?
I know this question is quite old, but as new software comes out it does help to get some new links to projects that might be interesting for folks.
imgscalr is pure-Java image resizing (and simple ops like padding, cropping, rotating, brighten/dimming, etc.) library that is painfully simple to use - a single class consists of a set of simple graphics operations all defined as static methods that you pass an image and get back a result.
The most basic example of using the library would look like this:
BufferedImage thumbnail = Scalr.resize(image, 150);
And a more typical usage to generate image thumbnails using a few quality tweaks and the like might look like this:
import static org.imgscalr.Scalr.*;
public static BufferedImage createThumbnail(BufferedImage img) {
// Create quickly, then smooth and brighten it.
img = resize(img, Method.SPEED, 125, OP_ANTIALIAS, OP_BRIGHTER);
// Let's add a little border before we return result.
return pad(img, 4);
}
All image-processing operations use the raw Java2D pipeline (which is hardware accelerated on major platforms) and won't introduce the pain of calling out via JNI like library contention in your code.
imgscalr has also been deployed in large-scale productions in quite a few places - the inclusion of the AsyncScalr class makes it a perfect drop-in for any server-side image processing.
There are numerous tweaks to image-quality you can use to trade off between speed and quality with the highest ULTRA_QUALITY mode providing a scaled result that looks better than GIMP's Lancoz3 implementation.
另一个不错的选择:马文
我不是 Java 人,但 OpenCV 非常适合我的需求。不确定它是否适合你的。这是一个Java端口,我认为: http ://docs.opencv.org/2.4/doc/tutorials/introduction/desktop_java/java_dev_intro.html
处理是新的,但非常非常好。
Try to use Catalano Framework.
Keypoints:
The Catalano Framework is a framework for scientific computing for Java and Android. The project started as an initial port of the many features of the AForge.NET and Accord.NET frameworks for .NET, but is steadily growing with more advanced features which are now being shared between those projects.
Example:
FastBitmap fb = new FastBitmap(bitmap);
Grayscale g = new Grayscale();
g.applyInPlace(fb);
Threshold t = new Threshold(120);
t.applyInPlace(fb);
bitmap = fb.toBitmap();
//Show the result
imo the best approach is using GraphicsMagick Image Processing System with im4java as a comand-line interface for Java.
There are a lot of advantages of GraphicsMagick, but one for all:
http://im4java.sourceforge.net/ - 如果您正在运行 linux,则分叉一个新进程并不昂贵。
对于商业工具,您可能想尝试 Snowbound。
我对他们的体验有些过时,但我发现他们的 Java Imaging API 比 JAI 更容易使用并且速度更快。
他们的客户支持和代码示例也非常好。
RoboRealm 视觉软件列表在许多其他非 Java 库中提到了 JHLabs和NeatVision 。
I cannot say that it is the "best" library, but I think you can try this: http://algart.net/java/AlgART/ It is an open-source Java library, supporting generalized "smart" arrays and matrices with elements of different types (from 1 bit to 64-bit floating point), including 2D-, 3D- and multidimensional image processing and other algorithms, working with arrays and matrices. Unfortunately right now it consists not enough demo and examples, but, on the other hand, it contains a lot of JavaDocs. It lay in the base of commercial software (SIMAGIS) during several years, but now it is open-source.