/// <summary> /// 保存本地图片 /// </summary> /// <param name="thisBitmapImage"></param> /// <param name="thisFilePath"></param> /// <returns></returns> public static bool WriteImage(this BitmapSource thisBitmapImage, string thisFilePath) { #region 保存本地图片 using (var memoryStream = new System.IO.MemoryStream()) { var wp = new WriteableBitmap(thisBitmapImage); wp.SaveJpeg(memoryStream, wp.PixelWidth, wp.PixelHeight, 0, 100); memoryStream.SaveStream(thisFilePath); return(true); } #endregion }
/// <summary> /// 保存本地图片 /// </summary> /// <param name="thisBitmapImage"></param> /// <param name="thisFilePath"></param> /// <returns></returns> public static bool WriteImage(this BitmapSource thisBitmapImage, string thisFilePath) { #region 保存本地图片 using (var memoryStream = new System.IO.MemoryStream()) { var wp = new WriteableBitmap(thisBitmapImage); wp.SaveJpeg(memoryStream, wp.PixelWidth, wp.PixelHeight, 0, 100); memoryStream.SaveStream(thisFilePath); return true; } #endregion }