public byte[] GetBitmapBytes(string content, int size = 230, string img_path = null) { using (var bm = GetBitmap(content, size, img_path)) { return(ConvertHelper.BitmapToBytes(bm)); } }
/// <summary> /// 获取问卷你调查地址二维码 /// </summary> /// <param name="surveyId"></param> /// <returns></returns> public ResultVO GetSurveyQrCode(string staticUrl) { ResultVO result = new ResultVO() { Result = 0 }; try { var tmpBitmap = QrCodeHelper.GeneratorQrImage(staticUrl); var tmpBytes = ConvertHelper.BitmapToBytes(tmpBitmap, System.Drawing.Imaging.ImageFormat.Gif); var Base64Str = Convert.ToBase64String(tmpBytes); result.Data = Base64Str; result.Result = 1; } catch (Exception ex) { result.ErrorMsg = ex.Message; } return(result); }
/// <summary> /// bitmap转byte数组 /// </summary> public static byte[] ToBytes(this Bitmap bm, ImageFormat formart) => ConvertHelper.BitmapToBytes(bm, formart);