onCameraFrame获取到的frame.data如何转为图片的base64
- onCameraFrame获取到的frame.data如何转为可用于设置背景的base64?或者最简单的能用frame.data生成背景图片的办法?
1 回复
可以试试先画到canvas上再保存为图片
wx.canvasPutImageData({ canvasId: 'myCanvas', x: 0, y: 0,
width: frame.width,
height: frame.height,
data: frame.data,
success (res) {
wx.canvasToTempFilePath({
x: 0, y: 0, width: frame.width, height: frame.height, canvasId: 'myCanvas', success(res) { console.log(res.tempFilePath)
}})
}})