What is the best java image processing library/approach?

JavaImage ProcessingImage Manipulation

Java Problem Overview


I am using both the JAI media apis and ImageMagick?

ImageMagick has some scalability issues and the JNI based JMagick isn't attractive either. JAI has poor quality results when doing resizing operations compared to ImageMagick.

Does anyone know of any excellent tools either open source or commercial that are native java and deliver high quality results?

Java Solutions


Solution 1 - 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.

Solution 2 - Java

There's ImageJ, which boasts to be the

> world's fastest pure Java image > processing program

It can be used as a library in another application. It's architecture is not brilliant, but it does basic image processing tasks.

Solution 3 - Java

Another good alternative: Marvin

Solution 4 - Java

I'm not a Java guy, but OpenCV is great for my needs. Not sure if it fits yours. Here's a Java port, I think: http://docs.opencv.org/2.4/doc/tutorials/introduction/desktop_java/java_dev_intro.html

Solution 5 - Java

Processing is new but very, very good.

Solution 6 - Java

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

Solution 7 - Java

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).

Solution 8 - Java

http://im4java.sourceforge.net/ - if you're running linux forking a new process isn't expensive.

Solution 9 - Java

For commercial tools, you might want to try Snowbound.

http://www.snowbound.com/

My experience with them is somewhat dated, but I found their Java Imaging API to be a lot easier to use than JAI and a lot faster.

Their customer support and code samples were very good too.

Solution 10 - Java

RoboRealm vision software list mentions JHLabs and NeatVision among lots of other non-Java based libraries.

Solution 11 - Java

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.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionDaniel HonigView Question on Stackoverflow
Solution 1 - JavaRiyad KallaView Answer on Stackoverflow
Solution 2 - JavaIvanView Answer on Stackoverflow
Solution 3 - JavaJosephView Answer on Stackoverflow
Solution 4 - JavakennyView Answer on Stackoverflow
Solution 5 - JavafmsfView Answer on Stackoverflow
Solution 6 - JavaDiego CatalanoView Answer on Stackoverflow
Solution 7 - JavakajoView Answer on Stackoverflow
Solution 8 - JavaAmanjit GillView Answer on Stackoverflow
Solution 9 - JavaClaytonView Answer on Stackoverflow
Solution 10 - JavaricsView Answer on Stackoverflow
Solution 11 - JavaDanielView Answer on Stackoverflow