hi, i want to resize the image . the size is reduced according to the resolution of image
and then save into database. but there is a condition to save the image in database is that it will check the size is not more than 30 kb and resolution 100x100 . can you send me the code for that in asp.net. its urgent
thanks in advance
Resize the image size and image resolution and save in to database in asp.net using c#
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.


Lalit MRank #1,186 · 1.5K reputationPosted Nov 13, 2009, 10:25 PM EST
// Construct a bitmap from the button image resource.
Bitmap bmp1 = new Bitmap(typeof(Button), "Button.bmp");
// Save the image as a GIF.
bmp1.Save("c:\\button.gif", System.Drawing.Imaging.ImageFormat.Gif);
// Construct a new image from the GIF file.
Bitmap bmp2 = new Bitmap("c:\\button.gif");
// Draw the two images.
e.Graphics.DrawImage(bmp1, new Point(10, 10));
e.Graphics.DrawImage(bmp2, new Point(10, 40));
// Dispose of the image files.
bmp1.Dispose();
bmp2.Dispose();
More info