About 21,200 results
Open links in new tab
  1. Convert an image (selected by path) to base64 string

    Jun 26, 2020 · You can use Server.Map path to give relative path and then you can either create image using base64 conversion or you can just add base64 string to image src. byte[] imageArray = System.IO.File.ReadAllBytes(Server.MapPath("~/Images/Upload_Image.png")); string base64ImageRepresentation = Convert.ToBase64String(imageArray);

  2. return base64 encoded images directly from a web api core

    Jul 1, 2017 · If you want to return images as base64 string you can do it like this: public IHttpActionResult GetImage() { var image = GetImageData(); var base64 = Convert.ToBase64String(image); return Ok(base64); }

  3. c# - Save image from result convert base64 string in asp.net core ...

    Dec 13, 2019 · string DefaultImagePath = HttpContext.Current.Server.MapPath("~/c:/image"); byte[] bytes = Convert.FromBase64String(imagestr); using (MemoryStream ms = new MemoryStream(bytes)) Image pic = Image.FromStream(ms); pic.Save(DefaultImagePath); commitTransaction(conn); catch (Exception ex) rollbackTransaction(conn);

  4. C# Convert Image to Base64: Encoding Images for Web …

    Feb 22, 2024 · This blog post explores methods and best practices for converting images to Base64 format in C#. We'll delve into practical examples using FileStream, Convert.ToBase64String, and helper methods. Learn how to handle image-to-Base64 conversions effectively in your C# projects, ensuring seamless integration with web applications.

  5. How to Convert an Image to Base64 String in C# - Delft Stack

    Mar 11, 2025 · If you’re working with C#, converting an image to a Base64 string is straightforward and can be done in just a few steps. This article will guide you through the process of converting an image into a Base64 string using …

  6. Convert And Retrieve Image From Base64 Using C# - C# Corner

    In this post, we will learn to convert and retrieve an image from base64. First, we will convert the image into base64 from a URL and second, convert the image from base64 using memory stream. The last step is to display the image in the image box using MemoryStream.

  7. Convert Image to Base64 in C# | JPG PNG to Base64

    Apr 15, 2025 · Let’s look at a practical example of how to load a JPG or PNG image from disk, convert it into a Base64 string, and embed it directly into an SVG document using C#. This approach is adaptable to various image types and application needs.

  8. Convert an Image to Base64 String and Base64 String to Image - C#

    byte [] imageBytes = Convert.FromBase64String(base64String); MemoryStream ms = new MemoryStream(imageBytes, 0, imageBytes.Length); ms.Write(imageBytes, 0, imageBytes.Length); System.Drawing.Image image = System.Drawing.Image.FromStream(ms, true); return image; } protected void ImageToBase_Click(object sender, EventArgs e) { TextBox1.Text ...

  9. Easy Way to Convert a Base64 Image to Byte Array in ASP.NET Core

    Feb 12, 2023 · In this post, we are going to write a piece of code to convert base64 image to byte array. I'm using a JavaScript image cropping plugin to provide the end-users the ability to crop images they upload on a Web App built on top of ASP.NET Core.

  10. Convert Image to Base64 String and Base64 String to Image in C#

    Image to Base64 String public string ImageToBase64(Image image, System.Drawing.Imaging.ImageFormat format) { using (MemoryStream ms = new MemoryStream()) { // Convert Image to byte[] image.Save(ms, format); byte[] imageBytes = ms.ToArray(); // Convert byte[] to Base64 String string base64String = Convert.ToBase64String(imageBytes); return ...

  11. Some results have been removed