[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: scaling a jpeg on a web server



Hi,

I understand that you would like to resize your uploaded picture and 
save. Next the server will show it to the user which is browsing the 
page. If this is true you do not need displaying ability of AWT/SWING 
- you do like to convert picture - not display it.

I went thrue this same path. The AWT/SWING is the worst and slowest 
what you can use. They are prepared for display!! not for manipulating 
the picture. For using above you have to have X server runing (and you 
IMHO definitly do not want to depend on this your application). 

I strongly recomend to take a look into JAI.
http://java.sun.com/products/java-media/jai/

It is flying and most of all it not depends on X server. 

On the page:
http://www.yourek.org/grafika/imageDimension.html

there is an example around your question - it is Polish Java FAQ - sorry 
it is in Polish but this was whole purpouse of it :)

Anyway it shows how to receive picture size. On top you have the code 
which uses AWT and on the bottom this same which uses JAI.

If you will have any additional questions please send me an email

Best of luck

Jerzy Puchala


On Sat, 14 Sep 2002, Michael Fortin wrote:

> Hello,
> 	Does anyone have any experience resizing or manipulating jpeg images  
> on a web server?  I'm trying to scale an uploaded image but I get the  
> following error in production:
> java.lang.InternalError: Can't connect to X11 window server using  
> ':0.0' as the value of the DISPLAY variable.
>          at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
[...]
> 
> it would appear that there is no computer monitor or display to  
> initialize so the default toolkit fails.  Is there a way to scale an  
> image without using the Toolkit?  I can't find any libraries that don't  
> use the it.
> 
> Any suggestions would be greatly appreciated.
> 
> Michael
> 



-- 
+--------------------------------+
|         Jerzy Puchala          |
+--------------------------------+
|       jerzypuc@scdi.com        |
+--------------------------------+