Exemple #1
0
 public static System.IO.Stream Resize(System.IO.Stream inputStream, int width, int height, ResizeMethod resizeMethod)
 {
     ImageProcessor imageProcessor = new ImageProcessor();
     ResizeFilter item = new ResizeFilter(width, height, resizeMethod);
     imageProcessor.Filters.Add(item);
     return imageProcessor.Process(inputStream);
 }
Exemple #2
0
 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);
 }
Exemple #3
0
        /// <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));
        }
Exemple #4
0
        /// <summary>
        /// 缩放图像
        /// </summary>
        /// <param name="inputStream">图像文件流</param>
        /// <param name="width">缩放后的宽度</param>
        /// <param name="height">缩放后的高度</param>
        /// <param name="resizeMethod">缩放方式</param>
        /// <returns>返回缩放后的图像文件流</returns>
        public static Stream Resize(Stream inputStream, int width, int height, ResizeMethod resizeMethod)
        {
            ImageProcessor imageProcessor = new ImageProcessor();
            ResizeFilter   resizeFilter   = new ResizeFilter(width, height, resizeMethod);

            imageProcessor.Filters.Add(resizeFilter);

            return(imageProcessor.Process(inputStream));
        }