jsp, open gif file and convert it to BufferedImage

S

Slava

I need to open a gif file from JSP, and convert it(type Image) to BufferedImage.

any thoughts and examples whould be appreciated!

Thanks!
 
M

Marco Schmidt

Slava:
I need to open a gif file from JSP, and convert it(type Image) to BufferedImage.

Create a new BufferedImage object of the same resolution as the Image
object and draw the Image object into the new BufferedImage using the
BufferedImage's Graphics context
(BufferedImage.getGraphics().drawImage).

Regards,
Marco
 
A

Andrew Thompson

Marco said:
Slava:


Create a new BufferedImage object of the same resolution as the Image
object and draw the Image object into the new BufferedImage using the
BufferedImage's Graphics context
(BufferedImage.getGraphics().drawImage).

For some reason I have the vague
recollection that 'image stuff' should
not be done in a jsp, but a Servlet.

[ Something to do with conent-type? ]

Can any of the people who actually
know J2EE (I am a relative noob to it)
confirm/correct/clarify?
 
A

Aidan

Andrew said:
Marco said:
Slava:


Create a new BufferedImage object of the same resolution as the
Image object and draw the Image object into the new BufferedImage
using the BufferedImage's Graphics context
(BufferedImage.getGraphics().drawImage).

For some reason I have the vague
recollection that 'image stuff' should
not be done in a jsp, but a Servlet.

[ Something to do with conent-type? ]

Can any of the people who actually
know J2EE (I am a relative noob to it)
confirm/correct/clarify?

JSP is designed to return text content types (plain, HTML, XML etc).
Servlets are better suited to processing and returning binary
content.

So, what puzzles me is why Slava wants to do this in a JSP. I assume
there is no confusion about the fact that it is the browser that
requests the images after it has retrieved the page. The page isn't
responsible for sending them or embedding them, since you can only
return one content type with each http request.

Are we missing something Slava?

A
 
M

Marco Schmidt

Andrew Thompson:
For some reason I have the vague
recollection that 'image stuff' should
not be done in a jsp, but a Servlet.

Ah, I didn't pay attention to the JSP part. I have no idea how that
influences the imaging part.

Regards,
Marco
 
A

Andrew Thompson

Marco said:
Andrew Thompson:


Ah, I didn't pay attention to the JSP part. I have no idea how that
influences the imaging part.

As I look back at the thread, I realise
I might have edited it better, the thought
re jsp/servlet occured to me before you
posted, but I was too busy to post at that
moment. When you posted, it reminded
me to check..
 
B

Berlin Brown

Marco said:
Andrew Thompson:




Ah, I didn't pay attention to the JSP part. I have no idea how that
influences the imaging part.

Regards,
Marco

If you are using tomcat-jasper, you can always check what the jsp to
servlet generates. The .java servlet file. Of course it is a mess of
nasty. Mainly for the bored. Try a really complicated one with taglibs
and stuff.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top