Reputation: 22224
I have two images in the form of (somewhat):
<img src="data: base64, OIJQWEFOIJQWEFOIJQWEF..." />
<img src="data: base64, OIJQWEFOIJQWEFOIJQWEF..." />
I have no choice in the matter, these images are always going to be set as base64 data.
If I were to POST these using some client side magic, how can I convert the strings to actual images?
public ActionResult Combine(string imageA, string imageB)
{
// imageA and imageB would be the strings.
return View();
}
Upvotes: 2
Views: 1845
Reputation: 56162
Use Convert.FromBase64String
method.
This method:
Converts the specified string, which encodes binary data as base-64 digits, to an equivalent 8-bit unsigned integer array.
Then you can use WebImage
class from System.Web.Helpers.dll
assembly to convert byte array to actual image and perform some manipulations on it.
Upvotes: 2