PHP GD sharpness filter

狂风中的少年 提交于 2019-12-02 02:17:42

问题


How can you make a sharpness filter with the PHP GD library?

So that this...

Turns to this...

If it is not possible with PHP, than what other languages are capable?


回答1:


I think he wants to use PHP's GD library. It's pretty easy: function.imageconvolution. Just search for 'sharpen' on the page and you'll see a matrix you can use for sharpening. It works pretty well, although I would recommend using ImageMagick if you're trying to do anything more than that.




回答2:


If the ImageMagick is installed in your PHP config, you can use Imagick::adaptiveSharpenImage

From the manual:

<?php
try {
    $image = new Imagick('image.png');
    $image->adaptiveSharpenImage(2,1);
} catch(ImagickException $e) {
    echo 'Error: ' , $e->getMessage();
    die();
}
header('Content-type: image/png');
echo $image;
?>

http://php.net/manual/en/function.imagick-adaptivesharpenimage.php




回答3:


There is a library called Unsharp Mask PHP, which does exactly what you need. http://vikjavev.no/computing/ump.php



来源:https://stackoverflow.com/questions/3576550/php-gd-sharpness-filter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!