弹来弹去跑马灯!

WPF C# 创建缩略图

不太精确的方法:

 public bool ThumbnailCallback()
        {
            return false;
        }

        private void CreateThumb(int toWidth)
        {
            System.Drawing.Image.GetThumbnailImageAbort myCallback =
            new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback);
            Bitmap myBitmap = new Bitmap("D:\\img100.jpg");
            double rate = (double)((double)myBitmap.Width / myBitmap.Height );
            int  toHeight =(int)((double )toWidth / rate);
            System.Drawing.Image myThumbnail = myBitmap.GetThumbnailImage(toWidth , toHeight, myCallback, IntPtr.Zero);
            myThumbnail.Save("D:\\okThumb.jpg");
        }

  

注意:由于int 和double的问题 无法精确。。。。。。。。。。。。。。。。。

posted @ 2019-08-19 18:05  wgscd  阅读(804)  评论(0)    收藏  举报