GeeCON Prague 2014*
The moose likes Servlets and the fly likes Clubbing two images using a servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "Clubbing two images using a servlet" Watch "Clubbing two images using a servlet" New topic
Author

Clubbing two images using a servlet

Mahesh Sivaraman
Greenhorn

Joined: Jun 19, 2002
Posts: 19
Hi,
i have some images (jpegs and gifs.). In my servlet I want to put my logo on the right top of the image and sent it back to the browser as a single image. I tried with JpegEncoder and GifEncoder from Acme.
How can i do that with my servlet.
Can anyone shed some light ?
Mahesh
[ September 01, 2002: Message edited by: mahesh sr ]
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

In 50 words or less:
You need to map your servlet as something like MyImageServetThing and then call images as /webapp/MyImageServetThing/otherImage.jpg
If you do it right then otherImage.jpg will be passed a parameter to the servlet. You can then load the image, paste your image over the top, set the content-type and throw the custom image back.
Damnit, 54 words
Dave
Mahesh Sivaraman
Greenhorn

Joined: Jun 19, 2002
Posts: 19
Hi,
thanx for the reply. But that is not my problem. i'll explain. I've loaded the images (main image and the logo). I've created a BufferedImage and draw both the images on it using its graphics object. Both are Jpegs. I gave that image to the JpegEncoder to encode it. But when it encodes only the main image comes. the logo is no longer there. Will the JPegEncoder cause any prob when we give it an image (BufferedImage) which contains two JPegs?? Any probs with the Jpeg header??
Regards
Mahesh
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Clubbing two images using a servlet