首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >电子desktopCapturer大版本缩略图

电子desktopCapturer大版本缩略图
EN

Stack Overflow用户
提问于 2021-10-28 19:16:23
回答 1查看 95关注 0票数 0

我使用desktopCapturer拍摄,并使用下面的代码拍摄桌面截图。

代码语言:javascript
复制
takeScreenshot() {
    desktopCapturer.getSources({ types: ['screen'] })
    .then( (sources: { thumbnail: { toDataURL: () => any; }; }[]) => {
      
      const theimage = sources[0].thumbnail.toDataURL(); // Thumbnail size image


    })
  }

我的问题是:sources[0].thumbnail.toDataURL()非常小。

它可以被放大吗?或者图片的放大版本在源代码中的某个地方?

如果是这样,在哪里或以什么方式?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-10-29 12:12:21

您可以将thumbnailSize作为设置传递给getSources()

https://www.electronjs.org/docs/latest/api/desktop-capturer#methods

代码语言:javascript
复制
takeScreenshot() {
    desktopCapturer.getSources({ types: ['screen'], thumbnailSize: { width: 800, height: 600 })
    .then( (sources: { thumbnail: { toDataURL: () => any; }; }[]) => {
      
      const theimage = sources[0].thumbnail.toDataURL(); // Thumbnail size image


    })
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69759686

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档