PC Review


Reply
Thread Tools Rate Thread

How to create and draw into a white empty Image

 
 
TheLetti
Guest
Posts: n/a
 
      3rd Aug 2005
Hi,

I created some thumbnails from pictures - they all have a size of up to
80 pixels in width or height (if it is a square pic, the size is
exactly 80 x 80, otherwise 80 pixel is the size of the greater
dimension).

For displaying purposes, I want to view them all in the same size, that
is 80 x 80.
Pictures that are smaller shall have a white border to fill up the size
to 80 pixels.

How can I do that? I have the thumbnail already in a
System.Drawing.Image object, but I have no clue how to add this white
border, or even how to create the empty 80 x 80 white picture first,
where I want to draw my thumbnail into. I looked already for the
classes Bitmap, DrawImage, Graphics (all in namespace System.Drawing),
but couldn't find any appropriate method.


I appreciate any help,

TheLetti

 
Reply With Quote
 
 
 
 
Markus Stoeger
Guest
Posts: n/a
 
      4th Aug 2005
TheLetti wrote:
> How can I do that? I have the thumbnail already in a
> System.Drawing.Image object, but I have no clue how to add this white
> border, or even how to create the empty 80 x 80 white picture first,
> where I want to draw my thumbnail into. I looked already for the
> classes Bitmap, DrawImage, Graphics (all in namespace System.Drawing),
> but couldn't find any appropriate method.


Try that...

// create a new bitmap
Bitmap bmp = new Bitmap(200, 200);

// get a Graphics object for drawing on the bitmap
Graphics g = Graphics.FromImage(bmp);

// draw on it
g.FillRectangle(Brushes.White, 0, 0, bmp.Width, bmp.Height);
g.FillEllipse(Brushes.Red, 0, 0, bmp.Width, bmp.Height);

// save it, or put it in a picturebox,...
bmp.Save(@"C:\MyImage.bmp", ImageFormat.Bmp);
 
Reply With Quote
 
TheLetti
Guest
Posts: n/a
 
      4th Aug 2005
Hello Markus,

thank you very much for your input. I figured it out right now thanks
to your help.


greez,
TheLetti

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How do I create an image for picture insert WITHOUT the white box. Geetesh Bajaj Microsoft Powerpoint 0 2nd Sep 2004 03:41 AM
Re: How do I create an image for picture insert WITHOUT the white box. Echo S Microsoft Powerpoint 0 1st Sep 2004 10:18 PM
Re: How do I create an image for picture insert WITHOUT the white box. TAJ Simmons Microsoft Powerpoint 0 1st Sep 2004 10:12 PM
. Re: image problems and the palette and Re: white bitmap is not 100% white Jon Pawley Microsoft Dot NET Compact Framework 0 5th Mar 2004 03:06 AM
How to create an empty Image? Mehdi Mousavi Microsoft C# .NET 1 9th Dec 2003 05:49 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:02 PM.