modulate() 函數是 GraphicsMagick 庫中的內置函數,用於改變圖像的亮度、飽和度和色調。該函數返回成功的真實值。
用法:
modulate( brightness, saturation, hue )
參數:該函數接受如上所述和如下所述的三個參數:
- Brightness:該參數用於指定亮度級別的值。
- Saturation:該參數用於指定飽和度級別的值。
- Hue:該參數用於指定色調級別的值。
返回值:該函數返回GraphicsMagick對象。
示例 1:
javascript
// Include gm library
const gm = require('gm');
// Import the image
gm('1.png')
// Invoke borderColor() function
// and set border color to green
.borderColor('Green')
// Invoke resize function
.border(10, 30)
// Invoke modulate function
.modulate(50, 50, 50)
// Process and Write the image
.write("modulate1.png", function (err) {
if (!err) console.log('done');
});
輸出:
示例 2:
javascript
// Include gm library
const gm = require('gm');
//Import the image
gm(600, 300, 'white')
// set the color for the stroke
.stroke("green", 3)
// Set the font
.font("Helvetica.ttf", 60)
// Call to drawText Function
.drawText(100, 280, "GeeksforGeeks!")
// Invoke borderColor() function
// and set border color to green
.borderColor("Green")
// Invoke border function
.border(62, 32)
// Invoke motionBlur() function
.modulate(120, 110, 130)
// Process and write the image
.write("modulate2.png", function (err) {
if (!err) console.log('done');
});
輸出:
參考:
相關用法
- Node.js GM modulate()用法及代碼示例
- Node.js GM monochrome()用法及代碼示例
- Node.js GM motionBlur()用法及代碼示例
- Node.js GM minify()用法及代碼示例
- Node.js GM magnify()用法及代碼示例
- Node.js GM median()用法及代碼示例
- Node.js GM swirl()用法及代碼示例
- Node.js GM rotate()用法及代碼示例
- Node.js GM stroke()用法及代碼示例
- Node.js GM shade()用法及代碼示例
- Node.js GM trim()用法及代碼示例
- Node.js GM wave()用法及代碼示例
- Node.js GM sharpen()用法及代碼示例
- Node.js GM blur()用法及代碼示例
- Node.js GM charcoal()用法及代碼示例
- Node.js GM drawRectangle()用法及代碼示例
- Node.js GM drawEllipse()用法及代碼示例
- Node.js GM drawArc()用法及代碼示例
- Node.js GM drawLine()用法及代碼示例
- Node.js GM drawBezier()用法及代碼示例
- Node.js GM drawCircle()用法及代碼示例
- Node.js GM drawPolyline()用法及代碼示例
- Node.js GM drawPolygon()用法及代碼示例
- Node.js GM flip()用法及代碼示例
- Node.js GM flop()用法及代碼示例
注:本文由純淨天空篩選整理自sarthak_ishu11大神的英文原創作品 Node.js GM modulate() Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。