日期:2014-05-17 浏览次数:20410 次
/// <summary>
/// 生成缩略图
/// </summary>
/// <param name="sourcePicture">源图(绝对路径)</param>
/// <param name="targetPicture">缩略图(绝对路径)</param>
/// <param name="thunbmailWidth">缩略图宽度</param>
/// <param name="thunbmailHeight">缩略图高度</param>
/// <param name="makeModel">生成缩略图的方式(可用值为1:指定高宽缩放,可能变形;2:指定宽,高按比例;3:指定高,宽按比例;4:指定高宽裁减,不变形;)</param>
public static void MakeThumbnail(string sourcePicture, string targetPicture, int thunbmailWidth, int thunbmailHeight, int makeModel)
{
System.Drawing.Image m_imgSource = System.Drawing.Image.FromFile(sourcePicture);
int m_iTargetWidth = thunbmailWidth;
int m_iTargetHeight = thunbmailHeight;
int x = 0;
int y = 0;
int m_iSourceWidth = m_imgSource.Width;
int m_iSourceHeight = m_imgSource.Height;