我一直致力于在 Google Apps Script 中制作項目,但遇到了一個問題。我目前正在嘗試通過使用 HTML 畫布獲取圖像的各個像素(如果您知道另一種從 JS 中的圖像獲取像素數據的方法,請告訴我)。問題是,Google Apps 腳本似乎沒有畫布的 getContext 方法。我不確定這是故意的,還是某種錯誤。代碼:var img = XmlService.createElement('img');img.src = query;var canvas1 = XmlService.createElement('canvas');var context = canvas1.getContext('2d');錯誤:TypeError: canvas1.getContext 不是函數(第 8 行,文件“代碼”)我不確定如何解決或解決這個問題。
通過 XmlService 創建畫布元素時出現“canvas1.getContext 不是函數”錯誤
holdtom
2022-12-18 16:15:54