Last post Jun 16, 2005 07:43 AM by JasonFollas
Jun 15, 2005 05:26 PM|shapper|LINK
Jun 15, 2005 10:16 PM|DarrellNorton|LINK
Jun 16, 2005 07:43 AM|JasonFollas|LINK
Your width is a constant reduction (25% of original size), which makes it slightly easier rather than trying to take any dimension and scale to 50px wide...
1. Load the original into an Image object, and get the height.
2. Create a new Bitmap with a width and height that is 25% of original values.
3. Get a Graphics object for the bitmap.
4. Draw the original onto the bitmap, specifying a rectangle the size of the bitmap
5. Save file (or do whatever you need to do with it).
6. Dispose objects.
System.Drawing.Image original = System.Drawing.Image.FromFile(@"c:\10yearsreunion.jpg");
int height = original.Height;
int width = original.Width;
System.Drawing.Bitmap newPic = new System.Drawing.Bitmap(width/4, height/4);
System.Drawing.Graphics gr = System.Drawing.Graphics.FromImage(newPic);
gr.DrawImage(original, 0, 0, (width/4), (height/4));