Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

convert bitmap to imagesource

 public BitmapSource ConvertToBitmapSource(Bitmap src, ImageFormat imageFormat)
        {
            try
            {
                MemoryStream ms = new MemoryStream();
                src.Save(ms, imageFormat);
                BitmapImage image = new BitmapImage();
                image.BeginInit();
                ms.Seek(0, SeekOrigin.Begin);
                image.StreamSource = ms;
                image.EndInit();
                return image;
            }
            catch
            {
                // ignored
            }

            return null;
        }
Comment

PREVIOUS NEXT
Code Example
Csharp :: instantiate object inside of object Unity 
Csharp :: c# C# read text from a certain line number from string 
Csharp :: implicit vs explicit cast c# 
Csharp :: csv to xml using xmldocument c# 
Csharp :: c# code examples 
Csharp :: Transpose Matrix C Sharp 
Csharp :: math in c# 
Csharp :: remove numericUpDown arrows 
Csharp :: assert throw 
Csharp :: unity read console log 
Csharp :: action c# 
Csharp :: how to add object in dictionary in c# 
Csharp :: How to find column name with column index in DataGridView 
Csharp :: RestRequest AdvancedResponseWriter site:stackoverflow.com 
Csharp :: scaffolding in vs22 asp.net 6 
Csharp :: 1180 beecrowd URI 
Csharp :: c# odp.net close session 
Csharp :: Bedingungen in C# – if, else und else if 
Csharp :: deleting an item from a vector c# 
Csharp :: mesh decimate pyvista 
Csharp :: close an open form when you open it again c# 
Csharp :: unity time.fixeddeltatime 
Csharp :: blazor wasm roles not working 
Csharp :: hierachical table to c# class 
Csharp :: C# Search in JSON without deserialization 
Csharp :: c# convert address to int 
Csharp :: read text c# 
Csharp :: sequelize instance method is not a function 
Csharp :: inline c# custom operator implicit 
Csharp :: unity create file name datetime 
ADD CONTENT
Topic
Content
Source link
Name
4+9 =