Answers for "c# convert bitmap to image"

C#
0

bitmap to imagesource c#

//If you get 'dllimport unknown'-, then add 'using System.Runtime.InteropServices;'
    [DllImport("gdi32.dll", EntryPoint = "DeleteObject")]
    [return: MarshalAs(UnmanagedType.Bool)]
    public static extern bool DeleteObject([In] IntPtr hObject);

    public ImageSource ImageSourceFromBitmap(Bitmap bmp)
    {
        var handle = bmp.GetHbitmap();
        try
        {
            return Imaging.CreateBitmapSourceFromHBitmap(handle, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
        }
        finally { DeleteObject(handle); }               
    }
Posted by: Guest on January-28-2021
-1

c# bitmap to Image

var codeBitmap = new Bitmap(your_info);
Image image = (Image)codeBitmap;
Posted by: Guest on June-02-2020
0

c# convert bitmap to image

Bitmap inherits from System.Drawing.Image
Posted by: Guest on August-17-2020

Code answers related to "c# convert bitmap to image"

C# Answers by Framework

Browse Popular Code Answers by Language