Convert image path to base64 string
using ( Image image = Image . FromFile ( Path )) { using ( MemoryStream m = new MemoryStream ()) { image . Save ( m , image . RawFormat ); byte [] imageBytes = m . ToArray (); // Convert byte[] to Base64 String string base64String = Convert . ToBase64String ( imageBytes ); return base64String ; } } OR public class Base64Image { public static Base64Image Parse ( string base64Content ) { if ( string . IsNullOrEmpty ( base64Content )) { throw new ArgumentNullException ( nameof ( base64Content )); } int indexOfSemiColon = base64Content . IndexOf ( ";" , StringComparison . OrdinalIgnoreCase ); string dataLabel = base64Content . Substring ( 0 , indexOfSemiColon ); string contentType = dataLabel . Split ( ':' ). Last (); var startIndex = base64Content . IndexOf ( "base64," , Stri...