I am currently working with a javascript function that sends the image from my View's canvas to the controller as a string. However, I am looking for a way to convert this string into a Bitmap format. Can anyone provide guidance on how to achieve this?
document.getElementById('save').addEventListener('click', function () {
var image = document.getElementById("canvas").toDataURL("image/png");
image = image.replace('data:image/png;base64,', '');
$.ajax({
type: 'POST',
url: "Attendance/Decode",
data: '{ "imageData" : "' + image + '" }',
contentType: 'application/json; charset=utf-8',
dataType: 'json',
success: function (msg) {
alert("Done, Picture Sent.");
}
});
});
Controller Method:
public ActionResult Decode(string imageData)
{
//Convert imageData to Bitmap
}
Is there an alternative approach to send the canvas image as a Bitmap to the controller?