public static Image ApplySizeChanges(Image img)
        {
            switch (Engine.conf.ImageSizeType)
            {
            case ImageSizeType.FIXED:
                img = GraphicsMgr.ChangeImageSize(img, Engine.conf.ImageSizeFixedWidth, Engine.conf.ImageSizeFixedHeight);
                break;

            case ImageSizeType.RATIO:
                img = GraphicsMgr.ChangeImageSize(img, Engine.conf.ImageSizeRatioPercentage);
                break;
            }
            return(img);
        }
        private static Image DrawImageWatermark(Image img, string imgPath)
        {
            try
            {
                if (!string.IsNullOrEmpty(imgPath) && File.Exists(imgPath))
                {
                    int   offset = (int)Engine.conf.WatermarkOffset;
                    Image img2   = Image.FromFile(imgPath);
                    img2 = GraphicsMgr.ChangeImageSize((Bitmap)img2, (float)Engine.conf.WatermarkImageScale);
                    Point imgPos = FindPosition(Engine.conf.WatermarkPositionMode, offset, img.Size, img2.Size, 0);
                    if (Engine.conf.WatermarkAutoHide && ((img.Width < img2.Width + offset) ||
                                                          (img.Height < img2.Height + offset)))
                    {
                        return(img);
                        //throw new Exception("Image size smaller than watermark size.");
                    }

                    Graphics g = Graphics.FromImage(img);
                    g.SmoothingMode = SmoothingMode.HighQuality;
                    g.DrawImage(img2, imgPos);
                    if (Engine.conf.WatermarkAddReflection)
                    {
                        Bitmap bmp = AddReflection((Bitmap)img2, 50, 200);
                        g.DrawImage(bmp, new Rectangle(imgPos.X, imgPos.Y + img2.Height - 1, bmp.Width, bmp.Height));
                    }
                    if (Engine.conf.WatermarkUseBorder)
                    {
                        g.DrawRectangle(new Pen(Color.Black), new Rectangle(imgPos.X, imgPos.Y, img2.Width - 1, img2.Height - 1));
                    }
                }
            }
            catch (Exception ex)
            {
                FileSystem.AppendDebug("Error while drwaing image watermark", ex);
            }
            return(img);
        }