Last post Dec 16, 2008 09:48 AM by Golf-Driver
Dec 14, 2008 06:07 PM|Golf-Driver|LINK
I hope here somebody can help me!
I would like to draw a picture on another picture, but I have no idea to do this.
I am very grateful for tips or source code. [:D] [:D]
Creating thumbnail from Images
asp.NET drawing images database
gdi+ memory bitmap sclaing drawimage resizing
system.drawing exceptions asp.net
drawing in asp.net
Dec 14, 2008 06:58 PM|Hubble|LINK
You have to use the existing classes under the System.Drawing namespace.
You will have to load both images in a Bitmap object, create a Graphics object from the Bitmap where you are going to draw on, draw the image and dispose the objects once you have saved it.
Bitmap bmp = new Bitmap(pathToImage1);
Bitmap bmp2 = new Bitmap(pathToImage2);
Graphics g = Graphics.FromImage(bmp1);
g.DrawImage(bmp2, .......); //Add the parameters you need (position, size), depends on the overload of the function you use.
Check this link if you need more info on Bitmap class:
Hope this helps.
Dec 15, 2008 06:42 AM|Golf-Driver|LINK
Yes, thank you this is what I have searched. [Yes]
But now I have a new question:
How I can find out which resolution has a picture.
So, if the resolution is greater than 120 x 80 then put the resolution on 120 x 80.
Dec 15, 2008 07:02 AM|Hubble|LINK
The Bitmap has two properties: Width & Height.
But you will have to create a blank Bitmap with the desired size and then draw on it both images. (Check all the constructors of Bitmap)
Dec 15, 2008 07:18 AM|Golf-Driver|LINK
Yes, but how Do I check whether the resolution is greater than 120x80?
With a If query?
Dec 15, 2008 11:28 AM|Hubble|LINK
Dim bmp as new Bitmap(pathToYourImage)
if bmp.Width>120 OrElse bmp.Height>180 then
'Your code here
Dec 16, 2008 02:36 AM|Golf-Driver|LINK
Yes, thank you.
That´s it =)
Dec 16, 2008 03:35 AM|Golf-Driver|LINK
Hey, I am it again =)
How Can I make the picture centered in the other?
g. DrawImage (bmp2, 10, 10);
The ten´s are position entries.
Can I do something like that?
g. DrawImage (bmp2, centre, centre);
Dec 16, 2008 04:40 AM|Hubble|LINK
g. DrawImage (bmp2, (bmp1.Width-bmp2.Width)/2, (bmp1.Height-bmp2.Height)/2);
Hope this helps
Dec 16, 2008 09:48 AM|Golf-Driver|LINK
Yes, very beautiful.