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