Skip to main content

Posts

Showing posts from April, 2014

Image Crop

bool CompressImage(string filePath, AjaxControlToolkit.AsyncFileUpload FileUploadImage, Double bmpW, Double bmpH)
    {
        //const Double bmpW = 150;
        //const Double bmpH = 140;
        if (FileUploadImage.HasFile)
        {
            int newWidth = Convert.ToInt32(bmpW);
            int newHeight = Convert.ToInt32(bmpH);
            string temp = System.IO.Path.GetTempPath();
            string strFileExt = FileUploadImage.FileName.Split('.')[FileUploadImage.FileName.Split('.').Length - 1];
            Bitmap upBmp = new Bitmap(Bitmap.FromStream(FileUploadImage.PostedFile.InputStream));
            //Bitmap newBmp = new Bitmap(newWidth, newHeight, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
            //newBmp.SetResolution(70, 70);
            double upWidth = upBmp.Width;
            double upHeight = upBmp.Height;
            float newX = 0, newY = 0;
            double reDuce = default(double);
            if (upWidth > upHeight)
            {
          …