收藏
回答

在鸿蒙系统(6.0.0.115)uni.canvasToTempFilePath 生成的图片不完整?

微信版本8.0.13.34 ,鸿蒙版本(6.0.0.115 SP16)使用uni.createCanvasContext绘制图片添加水印然后用uni.canvasToTempFilePath导出,结果图片不完整 在ios android 上都正常。

回答关注问题邀请回答
收藏

1 个回答

  • 智能回答 智能回答 本次回答由AI生成
    2025-12-11
    有用
    回复 4
    • 😌᭄阿巴阿巴 🌝᭄
      😌᭄阿巴阿巴 🌝᭄
      2025-12-15
      项目太大代码片段无法上传, uni.canvasToTempFilePath(
                        {
                          canvasId: ‘watermarkCanvas’,
                          x: 0,
                          y: 0,
                          width: this.canvasWidth,//原始图片的宽
                          height: this.canvasHeight,//原始图片的高
                          destWidth:  this.canvasWidth * this.dpr : this.canvasWidth,//图片宽*像素比
                          destHeight: t  this.canvasHeight * this.dpr : this.canvasHeight,,//图片高*像素比
                          fileType: ‘jpg’, 件大小
                          quality: 1,  
                          success: async res => {
                            // 获取压缩后文件大小
                           resolve(res.tempFilePath); // 压缩失败则使用原路径
                          },
                          fail: err => {
                            reject(err);
                          },
                        },
                        this,
                      );
                    }, 1000);
      2025-12-15
      回复
    • 智能回答 智能回答 本次回答由AI生成
      2025-12-15回复😌᭄阿巴阿巴 🌝᭄
    • 社区技术运营专员--阳光
      社区技术运营专员--阳光
      2025-12-16回复😌᭄阿巴阿巴 🌝᭄
      第三方框架才有问题吗
      2025-12-16
      回复
    • 😌᭄阿巴阿巴 🌝᭄
      😌᭄阿巴阿巴 🌝᭄
      2025-12-17回复社区技术运营专员--阳光
      用的就是uniapp 的框架
      2025-12-17
      回复
登录 后发表内容