Draw image on another image

Syco54645

Member
Joined
Dec 16, 2007
Messages
9
Programming Experience
5-10
Hello,

New to GDI here. I am looking for a way to draw (or insert what ever word you prefer her) an image (smaller) on top of another image (larger). I have been trying to find a method to do this but so far have turned up nothing. I am not even sure what I would want to search for. Any help would be greatly appreciated.

Thanks

-Syco54645
 
Get the Image and Graphics from it, use the DrawImage method.
VB.NET:
Dim i As Image = Image.FromFile(imageName)
Dim g As Graphics = Graphics.FromImage(i)
g.DrawImage(i.Clone, 10, 10, 80, 80)
g.Dispose()
 
I may just not understand the code, but it does not appear to show how to have one image with another image drawn inside of it. Meaning if I wanted to place another jpeg inside of the left frame area of this image
http://www.blackindustries.com/images/talisman/downloads/card-template.jpg so that the image could be saved, how would I do that. Right now I am just drawing multiple bitmaps to one graphic (i cannot get the code that I am using right now, computer is too slow for me to bare vb.net 2k8, just ordered a new one). At any rate, that is what I would like to do.

edit:
Upon second look I think i understand how I would do it now. It would be just having another image under j and do the draw image line again. correct? Even if I do that, how would I save it?
 
Actually, I'm not sure what you're asking. The first code sample draws a small image on top of another image.
 
What I want to do is this

I start out with the base image
card-template.jpg


Then I have this second image that I want to add to that image
stickgf8.jpg


Resulting in this
cardtemplateis3.jpg


Now the final product I would want to save as well. How can I accomplish this?

Thanks

-Syco54645
 
See the code sample in post 2. "i" is your first image, "i.clone" is your second image, change this to any image, for example "i2".
 
Use the Save method. i.save(...)
 
Back
Top