public static System.IO.Stream Crop(System.IO.Stream inputStream, Rectangle cropArea, int descWidth, int descHeight) { ImageProcessor imageProcessor = new ImageProcessor(); CropFilter item = new CropFilter(cropArea, descWidth, descHeight); imageProcessor.Filters.Add(item); return imageProcessor.Process(inputStream); }
/// <summary> /// 裁剪图像 /// </summary> /// <param name="inputStream">图像文件流</param> /// <param name="cropArea">原图待裁剪的矩形选区</param> /// <param name="descWidth">裁剪后图像的宽度</param> /// <param name="descHeight">裁剪后图像的高度</param> /// <returns>返回裁剪后的图像文件流</returns> public static Stream Crop(Stream inputStream, Rectangle cropArea, int descWidth, int descHeight) { ImageProcessor imageProcessor = new ImageProcessor(); CropFilter cropFilter = new CropFilter(cropArea, descWidth, descHeight); imageProcessor.Filters.Add(cropFilter); return(imageProcessor.Process(inputStream)); }