public static Image AddImgBorder(Bitmap resultImg, int BorderWidth, Color c) { try { float w = BorderWidth; using (Graphics g = Graphics.FromImage(resultImg)) { using (Brush brush = new SolidBrush(c)) { using (Pen pen = new Pen(brush, w)) { pen.DashStyle = DashStyle.Custom; g.DrawRectangle(pen, new Rectangle(0, 0, Math.Abs(resultImg.Width), Math.Abs(resultImg.Height))); g.Dispose(); } } } return(resultImg); } catch (Exception ex) { IQBLog log = new IQBLog(); log.log("AddImgBorder Error:" + ex.Message); throw ex; } }
public static Image GetImgFromUrl(string httpurl) { try { System.Net.WebRequest webreq = System.Net.WebRequest.Create(httpurl); System.Net.WebResponse webres = webreq.GetResponse(); System.IO.Stream stream = webres.GetResponseStream(); Image result = Image.FromStream(stream); return(result); } catch (Exception ex) { IQBLog log = new IQBLog(); log.log("GetImgFromUrl Error:" + ex.Message); throw ex; } }