當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Node.js GM whitePoint()用法及代碼示例

whitePoint() 函數是GraphicsMagick 庫中的內置函數,用於生成色度白點。該函數返回成功的真實值。

用法:

whitePoint(x, y)

參數:該函數接受如上所述和如下所述的兩個參數:

  • x:該參數用於指定白點的x坐標。
  • y:該參數用於指定白點的 y 坐標。

返回值:該函數返回GraphicsMagick對象。

例子:

javascript


// Include gm library 
const gm = require('gm'); 
// Import the image 
gm(500, 200, 'black') 
// Set the color for the stroke 
.stroke("green", 3) 
.background('green') 
.font("Helvetica.ttf", 60) 
.drawText(30, 160, "GeeksforGeeks!") 
// Invoke whitePoint function with 
// x, y as 250, 100 respectively. 
.whitePoint(250, 100) 
// Process and write the image 
.write("whitePoint1.png", function (err) { 
if (!err) console.log('done'); 
});

輸出:

參考:


相關用法


注:本文由純淨天空篩選整理自sarthak_ishu11大神的英文原創作品 Node.js GM whitePoint() Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。