ImageManagementClass图片类

一、类名Class

类名:PublicFunctions.ImageManagementClass

 

二、属性Properties

 

三、方法Methods

1、为图片创建缩略图

函数:public static bool CreatePreviewImage(int PreviewImageWidth, int PreviewImageHeight, string OriginImagePath, string PreviewImagePath, Int16 QualitySetting = 100, string MimeType = "image/jpeg")

返回: true/false

 

2、为图片创建缩略图(重载)同时获得原图片的宽度及高度

函数:public static bool CreatePreviewImage(int PreviewImageWidth, int PreviewImageHeight, string OriginImagePath, string PreviewImagePath, ref int OriginImageWidth, ref int OriginImageHeight, Int16 QualitySetting = 100, string MimeType = "image/jpeg")

返回: true/false

 

3、为图片创建缩略图(重载)同时获得原图片的宽度及高度

函数:ppublic static bool CreatePreviewImage(Stream stream, int MaxWidth, int MaxHeight, string PreviewImagePath, ref int OriginImageWidth, ref int OriginImageHeight, Int16 QualitySetting = 100, string MimeType = "image/jpeg")

返回: true/false

 

4、更改图片尺寸

函数:public static System.Drawing.Bitmap ResizeImage(System.Drawing.Image image, int width, int height)

返回: System.Drawing.Bitmap

 

5、为图片添加图片水印

函数:public static bool AddWaterImage(string OriginImagePath, string LogoImagePath, string WaterImageResultPath)

返回: true/false

 

6、在图片上面添加文字

函数:public static void AddText(string ImagePath, int MinWidth, int MinHeight, string text, Brush brush, string FontFamily = "宋体", float FontSize = 8)

返回: 无

 

7、获得图片的编码信息

函数:public static ImageCodecInfo GetCodecInfo(string mimeType)

返回: ImageCodecInfo

 

8、检测扩展名是否为图片

函数:public static bool CheckIsPhoto(string Extension)

返回: true/false

 

9、获得图片的尺寸

函数:public static Size GetImageSize(string path)

返回: Size

 

10、CropCircleImage裁剪圆形区域图形

函数:public static System.Drawing.Image CropCircleImage(string sourceFile, int circleUpperLeftX, int circleUpperLeftY, int circleDiameter, out string ErrorMsg, int PreviewImageWidth = 0, int PreviewImageHeight = 0)

返回: System.Drawing.Image

 

11、CreateThumbnail创建缩略图

函数:public static AjaxResultModel CreateThumbnail(string DataTableName, string UniqueKey, string SoureImageURL, int Width, int Height)

返回: string;AjaxResultModel

 

12、Rotate以逆时针为方向对图像进行旋转

函数:public static AjaxResultModel Rotate(string ImagePath, int angle)

返回: AjaxResultModel