2
IM使用Web contents.capture()函数从窗口得到的截图,但是图像的质量不令人满意时 继承人的代码电子低质量NativeImage toJPG
ipcRenderer.on('saved-file', (event, path) =>{
if (path) {
remote.BrowserWindow.getFocusedWindow().webContents.[capturePage][1]((image)=>{
scrImage = image.toJPEG(100);
console.log(scrImage.toString());
fs.writeFile(path, scrImage, (err) => {
if (err) {
console.error(err);
}
console.log(path);
});
});
,你可以看到在图像上方Res对我们的用户来说不够好;电子Demo中的 DemoAPI质量的Capture图像是一样的。
有没有其他方法可以获得更好的质量?
你能解释一下对图片不满意吗?发表示例 – HSchmale
@Hschmale用户声称它的用例不够好 – alirezaac
是否有toPng方法和resize方法? – HSchmale