wx.canvasToTempFilePath 导出图片时,预期导出源图片中间的部分,即宽高各一半的中心区域
const width = canvas.width;
const height = canvas.height;
wx.canvasToTempFilePath({
x: width * 0.25,
y: height * 0.25,
width: width * 0.5,
height: height * 0.5,
fileType: "jpg",
canvas: canvas,
});
但实际导出的内容,并非图片的中心部位,而是偏右下角的区域,详细可参考代码片段中的演示;
源图片(预期导出红色方框的区域)
实际导出的图片如下: