wood burning stoves 2.0*
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

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Clubbing two images using a servlet" Watch "Clubbing two images using a servlet" New topic

Clubbing two images using a servlet

Mahesh Sivaraman

Joined: Jun 19, 2002
Posts: 19
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 ?
[ September 01, 2002: Message edited by: mahesh sr ]
David O'Meara

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
Mahesh Sivaraman

Joined: Jun 19, 2002
Posts: 19
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??
I agree. Here's the link: http://aspose.com/file-tools
subject: Clubbing two images using a servlet
Similar Threads
images display problem with dispatcher.forward()
Displaying a buffered image in html from a servlet
Binary to string conversion
retrieve multiple images from mysql
Adjusting the size of an image (jpg)?