繁体   English   中英

如何将 SoftwareBitmap object 保存到 bmp 文件 C#, UWP

[英]How to save SoftwareBitmap object to bmp file C#, UWP

我将 jpg 图像转换为 SoftwareBitmap object,我希望它能工作。 代码如下。

SoftwareBitmap softwareBitmap;

            using (IRandomAccessStream stream = await file.OpenAsync(FileAccessMode.Read))
            {
                // Create the decoder from the stream
                BitmapDecoder decoder = await BitmapDecoder.CreateAsync(stream);

                // Get the SoftwareBitmap representation of the file
                softwareBitmap = await decoder.GetSoftwareBitmapAsync();


            }

所以我现在不知道如何使用这个softwareBitmap制作.bmp文件..提前谢谢。

使用Bitmap代替:


using (IRandomAccessStream stream = await file.OpenAsync(FileAccessMode.Read))
{
    Bitmap bmp = new Bitmap(stream);
    bmp.Save(filePath, System.Drawing.Imaging.ImageFormat.Bmp);
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM