本文介绍了将WriteableBitmap导出为图像文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要导出剪切图像后得到的WriteableBitmap。我没有得到如何做到这一点,我使用以下内容:
Hi,
I need to export a WriteableBitmap that I get after cropping an image. I am not getting how to do that, I am using the following:
try
{
byte[] byteStream;
byteStream = ToByteArray(sample);
Stream stream = new MemoryStream(byteStream);
if (filename != null && filename != "")
{
string imgCropFileName = "Crop_" + DateTime.Now.Day + filename;
MessageBox.Show("FileName" + " " + imgCropFileName);
UploadFile(imgCropFileName, stream);
}
else
MessageBox.Show("FileName" + " " + filename);
}
catch (Exception ex) { MessageBox.Show(ex.Message); }
在代码段中,ToByteArray是一个将WriteableBitmap转换为字节数组的函数。
用于上传,我正在使用一个通用的处理程序,当命中并获取相关参数时,上传文件。
请帮帮我。
In the code segment ToByteArray is a function to convert WriteableBitmap into array of bytes.
For uploading, I am using a generic handler which when hit and get relevant parameters, uploads the file.
Please help me.
推荐答案
这篇关于将WriteableBitmap导出为图像文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!