With JDK 1.2, you don't need display at all.
 
Simply create an image like this:
BufferedImage img =
            new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
Graphics g = img.getGraphics();
 
then draw in g
 
then you can use any encoder that will encode an image to an outputstream
 
For GIF you can use ACME package
for JPEG    the JDK 1.2 include a JPEGImageEncoder
JPEG is faster, but images are far bigger
 
jdk 1.3 was supposed to include a PNG encoder (like JPEG) , but I didn't find it (I don't want to use adavanced Imaging, just for that).
Have you found it ?
 
Then, I use http://catcode.com/pngencoder/index.html
 
this PNG encoder works well, but I have some pbs with PNG on Internet Explorer (looks like IE not recognize the png MIME type, i set the content type to image/png
Any Hint ?
 
 
 
 
 
-----Message d'origine-----
De : Madhavi Karanam <[EMAIL PROTECTED]>
À : [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date : vendredi 25 février 2000 23:50
Objet : Re: Generating image file ?

Generate the graph the way you do in applets. You can use kavachart or javachart from www.ve.com .Convert the graph using JPEG encoder or GIF encoder. JPEG encoder is faster than GIF encoder.
Store it in a file and access it like a image in the html file.
Madhavi
-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of Boon Huat
Sent: Thursday, February 24, 2000 7:23 PM
To: [EMAIL PROTECTED]
Subject: Generating image file ?

Hi all,
 
Does anybody know how to generate a simple image file(eg a graph or chart which is dynamic) from a servlet and output this to the client.
   
Thanks in advance.....
 
Regards
Boon Huat
 
 

Reply via email to