我使用desktopCapturer拍摄,并使用下面的代码拍摄桌面截图。
takeScreenshot() {
desktopCapturer.getSources({ types: ['screen'] })
.then( (sources: { thumbnail: { toDataURL: () => any; }; }[]) => {
const theimage = sources[0].thumbnail.toDataURL(); // Thumbnail size image
})
}我的问题是:sources[0].thumbnail.toDataURL()非常小。
它可以被放大吗?或者图片的放大版本在源代码中的某个地方?
如果是这样,在哪里或以什么方式?
发布于 2021-10-29 12:12:21
您可以将thumbnailSize作为设置传递给getSources()。
https://www.electronjs.org/docs/latest/api/desktop-capturer#methods
takeScreenshot() {
desktopCapturer.getSources({ types: ['screen'], thumbnailSize: { width: 800, height: 600 })
.then( (sources: { thumbnail: { toDataURL: () => any; }; }[]) => {
const theimage = sources[0].thumbnail.toDataURL(); // Thumbnail size image
})
}https://stackoverflow.com/questions/69759686
复制相似问题