当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


Node.js GM enhance()用法及代码示例


enhance()函数是GraphicsMagick库中的内置函数,该函数用于应用数字滤波器来增强噪点图像。成功时该函数返回真实值。

用法:

enhance()

参数:该函数不接受任何参数。



返回值:此函数返回GraphicsMagick对象。

范例1:

// Include gm library 
var 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 enhance function 
.enhance() 
  
// Process and Write the image 
.write("enhance1.png", function (err) { 
  if (!err) console.log('done'); 
});

输出:

范例2:

// Include gm library 
var 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 enhance() function 
.enhance() 
  
// Process and write the image  
.write("enhance2.png", function (err) { 
  if (!err) console.log('done'); 
});

输出:

参考:




相关用法


注:本文由纯净天空筛选整理自sarthak_ishu11大神的英文原创作品 Nodejs | GM enhance() Function。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。