261

我同时使用 JAI 媒体 API 和 ImageMagick?

ImageMagick 有一些可扩展性问题,基于 JNI 的 JMagick 也没有吸引力。与 ImageMagick 相比,JAI 在调整大小操作时质量较差。

有谁知道任何优秀的工具,无论是开源的还是商业的,都是原生 java 并提供高质量的结果?

4

11 回答 11

137

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.

于 2012-02-23T18:18:16.960 回答
94

ImageJ,它号称是

世界上最快的纯Java图像处理程序

它可以用作另一个应用程序中的库。它的架构并不出色,但它可以完成基本的图像处理任务。

于 2009-03-05T23:58:09.260 回答
33

另一个不错的选择:马文

于 2010-02-28T04:55:58.760 回答
10

我不是 Java 人,但 OpenCV 非常适合我的需求。不确定它是否适合你的。这是一个Java端口,我认为: http ://docs.opencv.org/2.4/doc/tutorials/introduction/desktop_java/java_dev_intro.html

于 2009-03-06T10:14:54.707 回答
9

处理是新的,但非常非常好。

于 2009-03-02T18:02:11.417 回答
5

Try to use Catalano Framework.

Keypoints:

  • Architecture like AForge.NET/Accord.NET.
  • Run in the both environments with the same code, desktop and Android.
  • Contains several filters in parallel.
  • Development is on full steam.

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
于 2013-07-09T20:45:50.390 回答
4

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:

  • GM is used to process billions of files at the world's largest photo sites (e.g. Flickr and Etsy).
于 2011-04-11T17:07:41.210 回答
3

http://im4java.sourceforge.net/ - 如果您正在运行 linux,则分叉一个新进程并不昂贵。

于 2010-08-13T14:40:33.150 回答
2

对于商业工具,您可能想尝试 Snowbound。

http://www.snowbound.com/

我对他们的体验有些过时,但我发现他们的 Java Imaging API 比 JAI 更容易使用并且速度更快。

他们的客户支持和代码示例也非常好。

于 2009-03-02T18:04:21.350 回答
2

RoboRealm 视觉软件列表在许多其他非 Java 库中提到了 JHLabsNeatVision 。

于 2009-03-13T15:54:06.627 回答
1

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.

于 2013-12-26T13:36:27.760 回答