Search results for 'Resizing Image'. 1 post(s) found.
I tried to change image file with PictureBox control. Following is the example to convert image size.
private void copy_to_resized_png(string tar, string src, int w, int h)
{
Image imgInput = Image.FromFile(src);
Bitmap bitmapResized = new Bitmap( imgInput, w, h);
// in case that you need to save as jpeg format
// just change
// ImageFormat.Png to ImageFormat.Jpeg
bitmapResized.Save(tar, ImageFormat.Bmp);
imgInput.Dispose();
bitmapResized.Dispose();
}
{
Image imgInput = Image.FromFile(src);
Bitmap bitmapResized = new Bitmap( imgInput, w, h);
// in case that you need to save as jpeg format
// just change
// ImageFormat.Png to ImageFormat.Jpeg
bitmapResized.Save(tar, ImageFormat.Bmp);
imgInput.Dispose();
bitmapResized.Dispose();
}
You can call above function as following:
copy_to_resized_png( "c:\\tmp2_mask1.png", "c:\\widget_104_mask2_v2.png", w, h);
Another posts included in "C#"
| How to set an certain color as transparent color on bitmap (0) | 2009/09/03 |
| How to convert text string to integer ? (0) | 2009/09/04 |
| How to convert integer to text string ? (0) | 2009/09/04 |
| How to display message box in C# (0) | 2009/09/03 |
| How to convert bitmap image to jpeg image ? (0) | 2009/09/03 |
| To load image from file (0) | 2009/09/03 |
| Finding process name on OS (0) | 2008/09/22 |
| Convert System.DateTime to UNIX timestamp (0) | 2008/09/22 |

Prev

Rss Feed