我使用图像处理sharp-js。在过去,我使用imagemagick。有一个很好的函数OilPaint用于平滑边缘。例如,在perl中
$error = $image->[0]->OilPaint( radius => 0 )现在我想从perl + imagemagick迁移到node + sharp-js。
如何在sharp-js中平滑边缘?
发布于 2021-06-17 22:56:50
在sharpjs中没有像imagemagik中的OilPaint那样的滤镜。但是结合使用sharp-js和graphicsmagick (它使用imagemagik)是没有问题的。
await sharp("cat.png")
.extract({
left: ankerX,
top: ankerY,
width: sizeX,
height: sizeY,
})
.toFile("cat_section.png");
await gm("cat_section.png")
.paint(1)
.write("cat_section_oil.png", function (err) {
if (err) console.log(err);
console.log("Oil Done!");
});如果你愿意,你可以很容易的编写你自己的过滤器。一些有用的代码+指令,你可以在这里找到Apply a Oil Paint/Sketch effect to a photo using Javascript
https://stackoverflow.com/questions/68000130
复制相似问题