【electron系列之二】复制图片


// 复制图片
ipcMain.on("copy",(event, arg) =>{

    const imagePath = path.join(appPath, `page/images/copyImg${arg.name}`)

    this.download(arg.url, imagePath, () => {
        const image = nativeImage.createFromPath(imagePath)
        const { width, height } = image.getSize()
        clipboard.writeImage(image, 'image')
    })

})

参考:https://github.com/electron/electron/issues/9351

  1.将图片保存到本地后

  2.从本地读取图片数据


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM