using System;
using System.IO;
using System.Drawing;
using System.Drawing.Imaging;

namespace ConsoleApplication7
{
class Program
{
static void Main(string[] args)
{
string imgsrc = @"C:\Users\Administrator\Desktop\a.jpg";
//Image image = Image.FromFile(imgsrc);
//image.Save(@"C:\Users\Administrator\Desktop\a1.png", ImageFormat.Png);//绝对路径
/* //图片截取一部分
Bitmap image = new Bitmap(imgsrc);
Bitmap image1 = new Bitmap(200,100);
int width = image.Width;
int height = image.Height;
Graphics g = Graphics.FromImage(image1);
Rectangle rect = new Rectangle(0, 0, 200, 100);
g.DrawImage(image,0,0,rect, GraphicsUnit.Pixel);
image1.Save(@"C:\Users\Administrator\Desktop\a1.png", ImageFormat.Png);
*/
/* //图片的放大和缩小
Bitmap image = new Bitmap(imgsrc);
Bitmap image1 = new Bitmap(300, 300);
Graphics g = Graphics.FromImage(image1);
Rectangle rect = new Rectangle(0, 0, 300, 300);
g.DrawImage(image, rect);
image1.Save(@"C:\Users\Administrator\Desktop\a1.jpg", ImageFormat.Jpeg);
*/
}
}
}