views:

321

answers:

10

I am designing a web application that does server side image processing in real time. Processing tasks include applying different effects like grayscale, blur, oil paint, pencil sketch etc on images in various formats. I want to build it using java/servlets which I am already familiar with. I found 3 options,

1) Use pure java imaging libraries like java.awt or http://www.jhlabs.com/ip/index.html 2) Use command line tools like Gimp/ImageMagick 3) Use c,c++ image libraries that have java bindings.

I don't know which of the above options is good keeping the performance in mind. It looks like option 2) and 3) are good performance wise, but I want to be sure before I rule out 1). I have also heard gimp cannot be run using command line unless gtk or xwindows is already installed on the server. Will there be any such problems with 2) or 3) while running them server side?

Also please suggest any good image processing libraries for this purpose.

+1  A: 

Imagemagick or graphicsmagick are pretty good, you can find wrappers for them in most languages.

There are quite a few online examples and tutorials for image manipulation using these libraries too

scaney
A: 

Java would have similar problems in a headless environment were Using Headless Mode in the Java SE Platform not available.

trashgod
A: 

I think the best thing to do is try option 1), and if it is not fast enough, try option 2). I am doing server-side image processing in some of my applications and I have found the performances to be quiet good.

Maurice Perry
A: 

You should look into the image processing in the Java2D package and if at all possible run on a Windows box with a suitable graphics card as Java can use it to accelerate the Java2D operations.

Thorbjørn Ravn Andersen
A: 

@WizardOfOdds: If I understand you right, we need to have xvnc to run softwares that aren't supposed to run headless. But the point is unless we have xvnc already on the hosted env or we have enough rights to install xvnc, we still can't run softwares that require full graphical environment on the machine. I thought this was the case with most hosted environments (except the dedicated server they provide where you have full control). Correct me if I am wrong.

plspl
A: 

I can recommend to use C++ libraries and interface from Java with them. One option for example is Intel Performance Primitives, that are optimized for SSE instructions and multicore. For some operations this can be in order of magnitude faster. IPP include highly optimized functions for most of the basic operations like: blur, color conversion, different filters, etc.

Ross
+1  A: 

Just to complicate things, the GIMP has an API, with a Java wrapper: JGIMP.

CPerkins
A: 

If you own the servers, the best possible option is to install a big fat GPU or two and use some GPU accelerated libraries to do your image processing. In my own simple image processing code in CUDA (image rotation), I get more than 100x speedup over the CPU with a Geforce GTX-285 (240 core GPU)

rep_movsd
A: 

I wont be having my own servers. I will have to go with a hosting provider. This makes it a bit complicated when it comes to installing softwares that might require root permissions.

I deployed java servlet on a hosted environment using jhlabs library for simple image processing operations like gray scaling and observed 2 things

  1. Haven't run into problems with headless environment yet. Might hit this issue at a later point when I try to do more complicated image processing operations.
  2. The performance was not bad. But I have to do load testing to make sure that performance is acceptable under realistic load.
plspl
A: 

I am developing a web applicaton for online image creation and processing, called rastaq (first preview on http://rq-online.deesceha.de). It is a Java Web Application and all graphics are based on Java 2D. It is extensible by new Operators and Types. Play around and see, how long it takes to recompute an image with new parameters.

The hardware platform is an Intel Quad-Core, 8GB RAM machine.

dsch