开发者

Serverside image processing

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 sur开发者_运维问答e 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.


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


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


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.


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.


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.


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


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


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)


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.


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.


There are many image processing frameworks that you can use in a Java server side applications (J2EE).

Take a look at Marvin. You can setup the project in the same way in a J2SE application. If you are using Tomcat, copy the Marvin folder into the tomcat root and add marvin_version.jar in your project libraries. You can process any image in server side using many algorithms.

In the case of having any problem, use the project Discussion Group or Google about how to use Marvin in a J2EE application.

An stackoverflow post about running Marvin on server side: Adding MarvinFramework to a WebApp on Tomcat7

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜