Wednesday, June 25, 2008

High quality image resizing in Java

I tried a dozens of different queries to learn about image resizing (or thumbnail creation) in java. Many helpful souls have written excellent articles on this topic. But, unfortunately, none of them offered really crisp quality. My benchmark for quality was resizing done with "convert" command of ImageMagick, which I think does a scarily good job.

Somebody also figured that this is not a trivial task. Hence they put commercial software for the same. ImageResize4J solves this simple problem, but unfortunately their minimum license fees of $150 is tad higher for me. To benchmark their results with various other techniques (sing JAI, Java2D, ..) they have put up the code for other techniques as well. Since I was fiddling with JAI, I picked that code and found the quality of output to be surprisingly good compared to other samples. (Obviously, their software definitely does a better job.)

It falls short of expectation on one count - image size. ImageMagick packs the punch in 4.7K, whereas the JAI takes anywhere from 7.2K to 8.4K depending on interpolation. (Bilinear interpolation gives smaller size than Bicubic.) You can play with compression ratio (0.95 in the code linked above) to a little lower say 0.9 or 0.85 to reduce the size by 25-35%. But, then you need to be cautious about a shade loss in quality.

To sum, I will buy ImageResize4J as soon as I can afford.

Labels: ,


Comments:
I have developed a library called ThumbMaster which is specifically targeted at Java programmers who need to resize images with JAI -- and get high quality results. It is implemented as a new JAI interpolation, and so the standard built-in operators (and their native acceleration) can all be used. Image quality and file size are both nearly identical to the results of ImageMagick, as they are both based heavily on the same image processing algorithms.

ThumbMaster's license fees are $100 less than ImageResize4j's, and free licenses are available to certain types of open source and personal projects.

For more information and a trial download, visit http://www.devella.net/thumbmaster
 
Post a Comment

Subscribe to Post Comments [Atom]





<< Home

This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]