Creating Thumbnails of Images without AWT
I've searched in a lot of places, and am becoming increasingly surprised I cannot find a straightforward answer to a problem I have. I run Tomcat on a server which has no X11, and I do not want to install it. However, I am also trying to create a servlet which will take an image from a byte array and create a thumbnail of it.
While I have seen many examples of this, all use AWT, which seems to require using X11 or some windowing system even to run at all (despite my not trying to create a window or anything). While I understand that there is an option that can be added to the initialization script for Tomcat ("JAVA_OPTS=-Djava.awt.headless=true") I would far prefer simple code that didn't use AWT at all.
Does anyone know how to create a thumbnail or resize an image without the use of the AWT library whatsoever? Thanks very much!
# 3
Hmm... sorry I didn't know that.
I remember seeing some section on this website about Java Imaging or something like that and it seemed totally independent of AWT.
I came accross another imaging article:
http://johnbokma.com/java/obtaining-image-metadata.html , this one doesn't seem to use AWT - at least I don't see any in the imports.
May be Images are supposed to work only with AWT.
Here's another set of examples:
http://www.exampledepot.com/egs/javax.imageio/pkg.html
that demonstrates the javax.imageio package, but those examples also use AWT.
I think one could re-size an image on a website to create thumbnails, by specifying a percent width and height. and may be there's no need to have a package to create thumbnails on a web page when it could be done with HTML and that's probably why there isn't image processing for web pages (this is just my guess work, I could be wrong)
Message was edited by:
appy77
# 4
You might want to take a look at Image Tags:
This JSP tag library generates and transforms images dynamically. It exposes some of the imaging capability available in Java2D, Java Advanced Imaging, ImageIO, etc., as a set of tags.
http://jakarta.apache.org/taglibs/sandbox/doc/image-doc/intro.html