Thumbnail Image 缩略图

public bool ThumbnailCallback()
        {
            return false;
        }

Image.GetThumbnailImageAbort myCallback = new Image.GetThumbnailImageAbort(ThumbnailCallback);

                  Image myThumbnailPicture;

                    Image imageFile = Image.FromFile(strPath);

                    int newWidth, newHeight;
                   
                    newWidth = 400;
                    newHeight = (int)((float)newWidth * imageFile.Height / imageFile.Width);
                       
                    Bitmap myBitmap = new Bitmap(imageFile);
                    Image myThumbnail = myBitmap.GetThumbnailImage(newWidth, newHeight, myCallback, IntPtr.Zero);


                    string strTempPicture = "ThumbnailImage.jpg";
                    myThumbnail.Save(strTempPicture, ImageFormat.Jpeg);

posted @ 2008-11-13 10:25  RobotTech  阅读(618)  评论(0编辑  收藏  举报