压缩图片的代码,很简单的比例问题。献个丑
/// <summary>
/// 压缩图片(小图片扩大成大图片的逻辑我没写,其实跟压缩一样的道理)
/// </summary>
/// <param name="FilePath">源文件路径</param>
/// <param name="saveFilePath">目标另存路径(带文件名)</param>
/// <param name="width"></param>
/// <param name="height"></param>
public static void YaSuo(string FilePath, string saveFilePath, float width, float height)
{
FileStream st = File.Open(FilePath, FileMode.Open);
Image img = new Bitmap(st);
Image imgNew = new Bitmap(Convert.ToInt32( width),Convert.ToInt32( height));
Graphics g = Graphics.FromImage(imgNew);
float nWidth, nHeight;
if (img.Width > widt