Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JSP Interest »

Re: Generating Images on the fly

Cesar Garcia Hernandez

2004-09-15

Replies:

ok. i'll try it.

thanks!


On Wed, 15 Sep 2004 10:27:39 +0530, RimZim Sinha
<rimzim.sinha@(protected):
> i dont know if its the best way to do..but i have done it the following way
>
> Called BarGraph.jsp in a html in thus
>
> <img src="BarGraph.jsp?choose=<%=strTable%>">
>
> BARGRAGH.JSP
> <%@(protected)' %>
> <%@(protected).*
> ,java.awt.*,java.awt.image.BufferedImage,com.sun.image.codec.jpeg.*,java.app
> let.*,java.util.*" %>
>
> <%
>
> //The graph is going to be an image in JPEG format, so we'll need to set the
> correct MIME, or content type.
> //The browser uses the MIME type to decide how to display the response.
> //The following code sets the MIME type:
> response.setContentType("image/jpeg");
>
> //The Java 2D API supplies the BufferedImage class,
> //which provides a way to store and manage pixel data in memory.
> BufferedImage bi = new
> BufferedImage(NLP_Constants.WIDTH,NLP_Constants.HEIGHT,
> BufferedImage.TYPE_INT_RGB);
>
> Graphics2D g = (Graphics2D)bi.getGraphics();
>
> g.setPaint(Color.white);
>
> // set up the Graphics2D context by calling the createGraphics() method:
>
> ServletOutputStream out0 = response.getOutputStream();
>
> JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out0);
> encoder.encode(bi);
>
> %>
>
>
>
>
> ----- Original Message -----
> From: "Cesar Garcia Hernandez" <zapcome@(protected)>
> To: <JSP-INTEREST@(protected)>
> Sent: Wednesday, September 15, 2004 4:47 AM
> Subject: Generating Images on the fly
>
> > hello everyone, im new on the list.
> >
> > I was looking for a good examples of how to generate images on the fly
> > with jsp. I search in google but i cant find one really good.
> >
> > Do you know where can i find a really good example about it?
> >
> > thanks to everyone.
> >
> > regards
> >
> > --
> > Cesar Garcia Hernandez
> > -----------------------------------
> > Desarrollador de Soluciones Web y Windows
> > Telf: 950-00020
> > Email : zapcome@(protected)
> >
> >
> ===========================================================================
> > To unsubscribe: mailto listserv@(protected)
> JSP-INTEREST".
> > For digest: mailto listserv@(protected)
> DIGEST".
> >
> > Some relevant archives, FAQs and Forums on JSPs can be found at:
> >
> > http://java.sun.com/products/jsp
> > http://archives.java.sun.com/jsp-interest.html
> > http://forums.java.sun.com
> > http://www.jspinsider.com
>
>



--
Cesar Garcia Hernandez
-----------------------------------
Desarrollador de Soluciones Web y Windows
Telf: 950-00020
Email : zapcome@(protected)

===========================================================================
To unsubscribe: mailto listserv@(protected)".
For digest: mailto listserv@(protected)".

Some relevant archives, FAQs and Forums on JSPs can be found at:

http://java.sun.com/products/jsp
http://archives.java.sun.com/jsp-interest.html
http://forums.java.sun.com
http://www.jspinsider.com
©2008 junlu.com - Jax Systems, LLC, U.S.A.