arkts的PixelMap转Base64的方法如下:
this.pixelMap = data; const imagePackerApi: image.ImagePacker = image.createImagePacker(); let packOpts: image.PackingOption = { format: 'image/jpeg', quality: 30 }; try { imagePackerApi.packing(data, packOpts).then((readBuffer)=>{ let bufferArr = new Uint8Array(readBuffer) let help = new util.Base64Helper var base = help.encodeToStringSync(bufferArr) hilog.debug(0x0001, "save the screenshot base:",base) }); } catch (err) { console.error(TAG, '保存文件失败,err=' + JSON.stringify(err)); }