motionBlur() 函數是 GraphicsMagick 庫中的內置函數,用於使用具有可配置半徑、西格瑪和角度的高斯卷積核來應用運動模糊效果。該函數返回成功的真實值。
句法:
motionBlur(radius, sigma, angle)
參數:該函數接受three上麵提到的參數和下麵說明的參數:
- radius:該參數用於指定半徑的值。
- sigma:該參數用於指定西格瑪的值。
- angle:該參數用於指定以弧度為單位的角度值。
返回值:該函數返回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 motionblur function
.motionBlur(10,30,30)
// Process and Write the image
.write("motionblur1.png", function (err) {
if (!err) console.log('done');
});
輸出:

輸出1
示例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
.motionBlur(10,10,10)
// Process and write the image
.write("motionblur2.png", function (err) {
if (!err) console.log('done');
});
輸出:

參考:
- http://www.graphicsmagick.org/GraphicsMagick.html#details-motion-blur
- https://www.npmjs.com/package/gm
相關用法
- Node.js GM motionBlur()用法及代碼示例
- Node.js GM monochrome()用法及代碼示例
- Node.js GM modulate()用法及代碼示例
- 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 motionBlur() Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。