如题,直接上JS
var imgData = canvas.toDataURL("image/png"); var data = imgData.substr(22); $.post(‘Gen‘, { ‘data‘: data, ‘remark‘: $(‘remark‘).val() } ,function(success) { $(‘#img1‘).src(‘data:image/jpeg;base64,‘ + success); } );
后台C#
string inputStr = data; byte[] arr = Convert.FromBase64String(inputStr); MemoryStream ms = new MemoryStream(arr); Bitmap bmps = new Bitmap(ms);
然后你要怎么处理都可以了
canvas图片base64编码后,ajax提交到后台
时间: 2024-12-15 13:02:11