简体   繁体   中英

How to save SoftwareBitmap object to bmp file C#, UWP

I converted jpg image to SoftwareBitmap object, I hope it will work. The code is below.

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();


            }

So I do not know now how to make.bmp file using this softwareBitmap.. Thanks in advance.

Use Bitmap instead:


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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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