Details on the conversion between C# pictures and byte[] and between byte[] and string
Examples are as follows:
//Mainly through Stream as the intermediate bridgepublic static Image ByteArrayToImage(byte[] iamgebytes) { MemoryStream ms = new MemoryStream(iamgebytes); Image image = (ms); return image; } public static byte[] ImageToByteArray(Image image) { MemoryStream ms = new MemoryStream(); (ms, ); return (); } public static string ByteArrayToString(byte[] bytes) { return Convert.ToBase64String(bytes); } public static string StringToByteArray(string image) { return Convert.FromBase64String(image); }
The above article discusses the conversion between C# pictures and byte[] and between byte[] and string in detail is all the content I share with you. I hope you can give you a reference and I hope you can support me more.
Related Articles
Implementation method of C# text line break
This article mainly introduces the implementation method of C# text line breaking. It is a relatively practical technique to implement line breaking length processing for specific strings through custom functions. It has certain reference value for in-depth learning of C#. Friends who need it can refer to it.2014-12-12Detailed explanation of how to quickly release large arrays of memory in C#
This article mainly introduces you to relevant information about how C# can quickly release large arrays of memory. The example code is introduced in this article in detail, which has certain reference learning value for everyone's study or work. Friends who need it, please learn with the editor below.2021-01-01In-depth analysis of XmlWriter writing to Xml in C#
This article provides a detailed analysis and introduction to XmlWriter writing to Xml in C#. For those who need it, please refer to it.2013-05-05Detailed explanation of the use of Application class in C# WPF programming
Each running WPF application is represented by an instance of the class. This class tracks all windows opened in the application and decides when to close the application. Let’s follow the editor to learn more about the use of the Application class.2024-04-04Summary of C# implementation method to obtain program path
This article mainly introduces the method of obtaining program paths in C#, and analyzes various common techniques for obtaining file paths in C#. It has certain reference value. Friends who need it can refer to it.2015-08-08Fully implemented C# ring buffer (queue)
This article mainly introduces the complete implementation code of C# ring buffer (queue). Interested friends can refer to it.2016-07-07Methods for asynchronous execution of tasks in C#
This article mainly introduces the method of C# asynchronous execution of tasks. It analyzes the implementation skills of C# asynchronous execution in a simple example. It has certain reference value. Friends who need it can refer to it.2015-07-07Modify Windows operating system time using C#
This article mainly introduces the use of C# to modify the time of Windows operating system, so as to help everyone better utilize the C# operating system. Interested friends can learn about it.2020-10-10Implementation example of C# paddlerocrsharp identification ID number
Paddlerocrsharp can perform picture recognition. This article mainly introduces the implementation example of C# paddlerocrsharp identification ID number. It has certain reference value. If you are interested, you can learn about it.2024-02-02C# How to get the time difference between two times and remove the weekend (take the working day)
This article mainly introduces the method of obtaining the time difference between two times in C# and removing weekends (taking working days). It can effectively realize the function of obtaining working days. Related skills involving C# time operation. Friends who need it can refer to it.2015-05-05