示例#1
0
        public static void SaveJPEG(ImageHandler objImageHandler, string strFileName)
        {
            //Set Output Type
            ImageCodecInfo objImageCodecInfo;
            objImageCodecInfo = Tools.GetEncoderInfo("image/jpeg");

            //Save
            objImageHandler.Image.Save(strFileName, objImageCodecInfo, null);
        }
示例#2
0
        public static void SaveJPEG(ImageHandler objImageHandler, string strFileName, int intSizePercent)
        {
            //Set Output Type
            ImageCodecInfo objImageCodecInfo;
            objImageCodecInfo = Tools.GetEncoderInfo("image/jpeg");

            Image objNewImage = Tools.Resize(objImageHandler.Image, intSizePercent);

            //Save
            objNewImage.Save(strFileName, objImageCodecInfo, null);
        }
示例#3
0
        public static ImageHandler GetImage(int intWidth, int intHeight, float fltDPI, Brush objBackgroundColor)
        {
            //Create Stage
            Bitmap objImage = new Bitmap(intWidth, intHeight);
            objImage.SetResolution(fltDPI, fltDPI);
            Graphics objStage = System.Drawing.Graphics.FromImage(objImage);

            //Define Bounds
            Rectangle objBounds = new Rectangle(0, 0, intWidth, intHeight);

            //Draw Background Color
            objStage.FillRectangle(objBackgroundColor, objBounds);

            //Return ImageHandler
            ImageHandler objImageHandler = new ImageHandler();
            objImageHandler.Image = objImage;
            objImageHandler.Stage = objStage;
            objImageHandler.Bounds = objBounds;
            return objImageHandler;
        }
示例#4
0
        public static Image Resize(ImageHandler objImageHandler, int intSizePercent)
        {
            Image objNewImage = Tools.Resize(objImageHandler.Image, intSizePercent);

            return(objNewImage);
        }