protected void btnCropAndSave_OnClick(object sender, EventArgs e) { var aImageTool = new ImageTool(); Stream fileLogo = null; string title = txtText.Value; if (fileUpload.HasFile) { fileLogo = fileUpload.PostedFile.InputStream; } Image image = aImageTool.DownloadImageFromUrl(imgContent.ImageUrl); int x = X.Value.Trim() != "" ? int.Parse(X.Value) : 0; X.Value = "0"; int y = Y.Value.Trim() != "" ? int.Parse(Y.Value) : 0; Y.Value = "0"; int w = W.Value.Trim() != "" ? int.Parse(W.Value) : image.Width; W.Value = "0"; int h = H.Value.Trim() != "" ? int.Parse(H.Value) : image.Height; H.Value = "0"; //string s = aImageTool.CropAndAddTitle(image, "test", Server.MapPath("~/Upload"), new Rectangle(x, y, w, h), // title, fileLogo); //imgResult.Text += ""; }