aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes how to build an image ontop of another image Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "how to build an image ontop of another image" Watch "how to build an image ontop of another image" New topic
Author

how to build an image ontop of another image

Jordan Smith
Ranch Hand

Joined: Apr 06, 2008
Posts: 89
Hi!
My customer has an interesting demand.
He is a jewelery designer.
He wants that a customer will be able to choose a picture of a jewelery (for example a ring) and the user will write down his name in an input box, and it will generate the jewelery with his name on it.
Please see the attached picture for example.
how can i do it? could it be a JAVA task?





[Thumbnail for ring1.jpg]

Fred Hamilton
Ranch Hand

Joined: May 13, 2009
Posts: 679
odelya yomtov-glick wrote:Hi!
My customer has an interesting demand.
He is a jewelery designer.
He wants that a customer will be able to choose a picture of a jewelery (for example a ring) and the user will write down his name in an input box, and it will generate the jewelery with his name on it.
Please see the attached picture for example.
how can i do it? could it be a JAVA task?




One way is to create a BufferedImage object using the original image. Then you could asociate a graphics context with that BufferedImage object, then by using graphics commands on the context, you will be directly mofifying the buffered image.

Have a look in the BufferedImage class for a method that returns a graphics context.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
You may have to combine several image processing techniques to achieve this. For starters, here's some code that blends two images into one given the alpha percentage:

And here's how to overlay text on an image: http://radio.javaranch.com/davo/2007/07/20/1184942077153.html One or both of these techniques should be useful.


Ping & DNS - updated with new look and Ping home screen widget
Fred Hamilton
Ranch Hand

Joined: May 13, 2009
Posts: 679
Ulf Dittmer wrote:You may have to combine several image processing techniques to achieve this. For starters, here's some code that blends two images into one given the alpha percentage:

And here's how to overlay text on an image: http://radio.javaranch.com/davo/2007/07/20/1184942077153.html One or both of these techniques should be useful.


OK, I'm interested. I know you know your stuff, so it's not clear to me why there would be several image processing techniques. You draw the second image on to the graphics context of the first image, making sure that your second image has the correct alpha for transparent background. Am I missing something, or is this just two different ways of describing the same thing?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
That comment wasn't so much about the approaches I mentioned - you're right that likely only one of them will be applied. What I meant was that other techniques beside these may have to be used to achieve the effect shown in that image: Note how the right side of the "R" blends into the loop of the ring - no simple text or image overlay can produce that effect.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19543
    
  16

Moving to Swing / AWT.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
Don't get me started about those stupid light bulbs.
 
subject: how to build an image ontop of another image
 
Similar Threads
Image location in the server?
i just love this splash screen !
scrolling graphics
sachin booed
Susan Sontag: On the Torture of Others