wx.canvasToTempFilePath 返回的图片大小问题和bug
发布于 4 年前 作者 sunming 7164 次浏览 来自 问答
const ctx = wx.createCanvasContext('editorCanvas')
ctx.drawImage(originalImagePath, 0, 0, imageWidthPx, imageHeightPx)
ctx.draw()
 
wx.canvasToTempFilePath({
  canvasId: 'editorCanvas',
  success: function(res) {
    console.log("tempFilePath",res.tempFilePath)
    wx.getImageInfo({
       src: res.tempFilePath,
       success: function (res) {
         console.log("cut imagesize:",res.width,res.height,res)
       }
    })

1,canvasToTempFilePath返回的图片既不是editorCanvas大小,也不是drawImage大小

2,选择图片,第一次drawImage后wx.canvasToTempFilePath没问题;第二次选择图片后wx.canvasToTempFilePath模拟器上出bug

回到顶部