When i try to convert base64string to Image in c# - c#

When i try to convert a base64string to an Image in C#, I'm getting output as "System.Drawing.Bitmap" instead of the actual Image:
public Image DownFile(string base64String)//string file
{
//Convert Base64 String to byte[]
byte[] imageBytes = Convert.FromBase64String(base64String);
MemoryStream ms = new MemoryStream(imageBytes, 0, imageBytes.Length);
//Convert byte[] to Image
ms.Write(imageBytes, 0, imageBytes.Length);
Image image = Image.FromStream(ms, true);
image.Save("E:/Project Utilitie Connection/FileDownloadTask/Images", System.Drawing.Imaging.ImageFormat.Jpeg);
return image;
}

try a using statement for the MemoryStream, like so:
byte[] bytes = Convert.FromBase64String(base64String);
Image image;
using (MemoryStream ms = new MemoryStream(bytes))
{
image = Image.FromStream(ms);
}
return image;

The framework is converting the Image object to string which is why you are seeing System.Drawig.Bitmap
Create a response, giving it the bytes from the converted base64 string and then setting the content type for response so the client will know how to render the content.
public class ValuesController : ApiController {
[HttpGet]
public IHttpActionResult DownFile(string base64String) {
if (!string.IsNullOrWhiteSpace(base64String)) {
byte[] imageBytes = Convert.FromBase64String(base64String);
var response = Request.CreateResponse(HttpStatusCode.OK);
response.Content = new ByteArrayContent(imageBytes);
response.Content.Headers.ContentType = new MediaTypeHeaderValue("image/jpg");
return ResponseMessage(response);
}
return BadRequest();
}
}
This is a very simplified example to demonstrate how it can be done. Take some time to review and understand what was done so that it can be implemented into your particular scenario.

Related

Unable to convert Images stored in resource file to Base64 string in Asp.net [C#]

I am trying to get images stored in resource file and then trying to convert it to base64 string. however it generate garbage string below is my code:
String imgBase64=Base64FromByteArray(ExtractResource(Properties.Resources.products_tipp_110));
public static byte[] ExtractResource(Bitmap image)
{
MemoryStream ms = new MemoryStream();
image.Save(ms, ImageFormat.Png);
if (ms == null)
return null;
byte[] imageByteArray = new byte[ms.Length];
ms.Read(imageByteArray, 0, imageByteArray.Length);
return imageByteArray;
}
private static string Base64FromByteArray(byte[] image)
{
return "base64:" + Convert.ToBase64String(image);
}
output:
base64:AAAAAAAAAAAAAAAAAAAAAAAAAAAAA..... with all A's
Can you try this byte[] imageByteArray = ms.ToArray() to convert the memory stream into byte array as below.
Also, make sure your image is png as you have used ImageFormat.Png
String imgBase64=Base64FromByteArray(ExtractResource(Properties.Resources.products_tipp_110));
public static byte[] ExtractResource(Bitmap image)
{
MemoryStream ms = new MemoryStream();
image.Save(ms, ImageFormat.Png);
if (ms == null)
return null;
byte[] imageByteArray = ms.ToArray();;
return imageByteArray;
}
private static string Base64FromByteArray(byte[] image)
{
return "base64:" + Convert.ToBase64String(image);
}
Give this function Image and the format of Image, it will return you 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 base64String;
}
}

Xamarin Android - Convert Image to Base 64

I've found this sample code to convert an image to base 64, I'm not sure how to pass an image into it though. I want to be able to give a path to a specific directory. I've managed to find a file with this code:
byte[] ImageData = File.ReadAllBytes("storage/emulated/0/DCIM/Camera/img.jpg");
But I need to pass that into the following code.
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 base64String;
}
}
Hope you can help. Thanks.
byte[] ImageData = File.ReadAllBytes(path_to_file);
string base64String = Convert.ToBase64String(ImageData);

How can i get an imagefrom the web with headers?

How can i get in c# an image as bitmapimage from an url and pass to it some headers? (not parameters, headers)
And also i found a simple solution but i couldn't understand why it was wrong, the problem is that:
WHen i get byte[] from the server i get the image with a lot of question marks, this appends i thinks because of a different text encoding, how can i fix the code so i can get successfully the image from c# with headers and visible to bitmap?
You have to convert your image into a base64 encoded string and pass it to the headers.
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;
}
}
Then on the other side you can parse it and convert it back to an image:
public Image LoadImage()
{
//data:image/png;base64,
byte[] bytes = Convert.FromBase64String(YOUR_BASE64_ENCODED_STRING);
Image image;
using (MemoryStream ms = new MemoryStream(bytes))
{
image = Image.FromStream(ms);
}
return image;
}

ArgumentExeption is unhandled when converting base64 to image

i am trying to convert image from base64 . When i run this code i get the error ArgumentException is unhandeled parameter is not valid . Below is my code
public void LoadImage()
{
string bytes = "rO0ABXNyACpjb20udXBzLmVjaXMuY29yZS5zaGlwbWVudHMuU2hpcG1lbnREaWdlc3QKXpgQMgLOlQIAIFoAF2lzQUJSUmV0dXJuZWRpblJlc3BvbnNlWgATaXNBQlJVc2VySW5lbGlnaWJsZVoABWlzQUlBWgATaXNDTjIyTnVtYmVyUHJlc2VudFoAD2lzQ04yMlJlcXVlc3RlZFoAHWlzQ29tYmluZWRNSWFuZExhYmVsSW5kaWNhdG9yWgAaaXNJdGVtaXplZENoYXJnZXNSZXF1ZXN0ZWRaAA9pc0tpYWxhU2hpcG1lbnRaACJpc01JRHVhbFJldHVybkFjY2Vzc29yaWFsUmVxdWVzdGVkWgAaaXNNSVJldHVyblNlcnZpY2VSZXF1ZXN0ZWRaABlpc01haWxJbm5vdmF0aW9uc1NoaXBtZW50WgAQaXNSZWNlaXB0VGhlcm1hbFoAGWlzU2hpcHBlckF1dGhvcml6ZWRCeVRQRkNaABJpc1N1cmVQb3N0U2hpcG1lbnRaABRpc1RQRkNSYXRlc1JlcXVlc3RlZFoAIWlzVFBGQ1JhdGVzUmVxdWVzdGVkQW5kQXV0aG9yaXplZFoAJGlzVVBTUHJlbWl1bUNhcmVBY2Nlc3NvcmlhbFJlcXVlc3RlZFoAHGlzVXNlckRpc2NvdW50UmF0aW5nRWxpZ2libGVaABJsYWJlbExpbmtJbmRpY2F0b3JaABJyYXRlQ2hhcnRJbmRpY2F0b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EZyb20gQ29tcGFueSBOYW1lcQB+AHFwdAAKOTk1ODM0OTI1NXBwcHEAfgBxcQB+AHFwcHB4cA==";
Base64ToImage(bytes);
}
public Image Base64ToImage(string base64String)
{
// Convert Base64 String to byte[]
byte[] imageBytes = Convert.FromBase64String(base64String);
MemoryStream ms = new MemoryStream(imageBytes, 0, imageBytes.Length);
// Convert byte[] to Image
ms.Write(imageBytes, 0, imageBytes.Length);
Image image1 = Image.FromStream(ms, true); // here error is generating
return image1;
}
I think that this line is more than enough, because it will create memory stream with image bytes.:
MemoryStream ms = new MemoryStream(imageBytes, 0, imageBytes.Length);
So this one is not needed as all bytes are already in the stream:
ms.Write(imageBytes, 0, imageBytes.Length);
To position the stream at its start replace the previous line with seek call:
ms.Seek(0, SeekOrigin.Begin);
EDIT
Maybe it has something to do with string or the format used, because with image created in place it works well:
static public void LoadImage()
{
String bytes = CreateImageBase64();
Base64ToImage(bytes);
}
static public Image Base64ToImage(string base64String)
{
// Convert Base64 String to byte[]
byte[] imageBytes = Convert.FromBase64String(base64String);
MemoryStream ms = new MemoryStream(imageBytes, 0, imageBytes.Length);
ms.Seek(0, SeekOrigin.Begin);
Image image1 = Image.FromStream(ms, true); // here error is generating
return image1;
}
static String CreateImageBase64()
{
//Create image
Image image = new Bitmap(3, 3);
//Save to stream
MemoryStream ms = new MemoryStream();
image.Save(ms, ImageFormat.Jpeg);
//Save to byte array
Byte[] imageBytes = new Byte[ms.Length];
ms.Seek(0, SeekOrigin.Begin);
ms.Read(imageBytes, 0, imageBytes.Length);
//Save to Base64
String base64Image = Convert.ToBase64String(imageBytes);
return base64Image;
}
...
LoadImage();
EDIT:
When I've used Encoding.ASCII.GetChars() on the array converted from Base64 string I got:
??\0sr\0*com.ups.ecis.core.shipments.ShipmentDigest\n^?2??\0 Z\0isABRReturnedinResponseZ\0isABRUserIneligibleZ\0isAIAZ\0isCN22NumberPresentZ\0isCN22RequestedZ\0isCombinedMIandLabe
It looks a bit strange for an image(of course if it does not contain enormous amounts of metadata). Maybe you can show the original xml. Who knows, the xml tag can be misnamed or misused.
Try This (If you want to set image directly to Image Control)
byte[] imageBytes = Convert.FromBase64String(base64string);
img.ImageUrl = "data:image/jpg;base64," + Convert.ToBase64String(imageBytes);

C# Base64 String to JPEG Image

I am trying to convert a Base64String to an image which needs to be saved locally.
At the moment, my code is able to save the image but when I open the saved image, it says "Invalid Image".
Code:
try
{
using (var imageFile = new StreamWriter(filePath))
{
imageFile.Write(resizeImage.Content);
imageFile.Close();
}
}
The Content is a string object which contains the Base64 String.
First, convert the base 64 string to an Image, then use the Image.Save method.
To convert from base 64 string to Image:
public Image Base64ToImage(string base64String)
{
// Convert base 64 string to byte[]
byte[] imageBytes = Convert.FromBase64String(base64String);
// Convert byte[] to Image
using (var ms = new MemoryStream(imageBytes, 0, imageBytes.Length))
{
Image image = Image.FromStream(ms, true);
return image;
}
}
To convert from Image to base 64 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 base 64 string
string base64String = Convert.ToBase64String(imageBytes);
return base64String;
}
}
Finally, you can easily to call Image.Save(filePath); to save the image.
So with the code you have provided.
var bytes = Convert.FromBase64String(resizeImage.Content);
using (var imageFile = new FileStream(filePath, FileMode.Create))
{
imageFile.Write(bytes ,0, bytes.Length);
imageFile.Flush();
}
public Image Base64ToImage(string base64String)
{
// Convert Base64 String to byte[]
byte[] imageBytes = Convert.FromBase64String(base64String);
MemoryStream ms = new MemoryStream(imageBytes, 0, imageBytes.Length);
// Convert byte[] to Image
ms.Write(imageBytes, 0, imageBytes.Length);
Image image = Image.FromStream(ms, true);
return image;
}
Front :
<Image Name="camImage"/>
Back:
public async void Base64ToImage(string base64String)
{
// read stream
var bytes = Convert.FromBase64String(base64String);
var image = bytes.AsBuffer().AsStream().AsRandomAccessStream();
// decode image
var decoder = await BitmapDecoder.CreateAsync(image);
image.Seek(0);
// create bitmap
var output = new WriteableBitmap((int)decoder.PixelHeight, (int)decoder.PixelWidth);
await output.SetSourceAsync(image);
camImage.Source = output;
}

Categories