Re: sizing down an uploaded photo
joe user <[email protected]>
| Newsgroups | gmane.comp.java.sun.servlet |
|---|---|
| Message-ID | <[email protected]> |
--- "Carter, Scott" <[email protected]> wrote: > I am hoping that someone using servlets has > encountered this problem. I > have a web site where user's can upload photos, but > after the servlet > uploads the file I would like it to also resize the > deminsions of the > picture and the quality (size). Has anyone run into > this problem? Yes. There are several options. Sun has a package which manipulates 2d images in various ways. I have not tried that one, however. The one that I have used is called JMagick, which is a Java wrapper for ImageMagick. You can download both from www.imagemagick.org. The advantage of JMagick is that it supports an amazing number of formats, is quite fast, and allows fine control over image transformation. For example you can choose different scaling algorithms, you can transform the color map in different ways, etc. The disadvantage is that it uses JNI. The disadvantages of JNI are the same as the disadvantages of C itself: there probably are buffer overflows lurking in there, and if there is a bug in ImageMagick which attempts to write to unallocated memory (the joys of C) it will crash the entire JVM itself. Instead of throwing an exception which is then caught and then displays as an error page, the JVM just instantly dies (no cleanup) and users see "server is refusing connections on port 80". I hope that Sun or someone else comes out with a high-performance pure Java image manipulation package that is as powerful as Imagemagick. Until then I am stuck with IM. I realize that the Sun solution does support plugins, so I could write my own handlers for various image types, but I don't want to spend time writing that kind of stuff. __________________________________ Do you Yahoo!? The New Yahoo! Search - Faster. Easier. Bingo. http://search.yahoo.com ___________________________________________________________________________ To unsubscribe, send email to [email protected] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html