C#实现图像缩略图的代码

来源:互联网 发布:数据挖掘主要应用 编辑:程序博客网 时间:2024/06/09 21:36

C#实现图像缩略图的代码如下:

                    Image image = Image.FromFile(@"C:\pic.JPG");
                    Image thumbImage = image.GetThumbnailImage(90, 120, null, IntPtr.Zero);
                    thumbImage.Save(@"C:\pic.thumb.JPG");

其中image.GetThumbnailImage实现缩略图,其原型为:

public Image GetThumbnailImage (int thumbWidth, //宽度int thumbHeight, //高度GetThumbnailImageAbort callback, //回调函数IntPtr callbackData //回调参数(必须为0))
这里将callback参数置为空,即屏蔽其委托(回调)机制。


原创粉丝点击