如何为图像添加滤镜(模糊)


How can I add a filter to image (blur)

我有一个场景。我想在循环前进时模糊我的图像。我怎样才能做到这一点?这是我的代码。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test Pagw</title>
</head>
<body>
<?php for($i=1; $i<=5; $i++){
/*
 * if $i=1, image will be clear
 * if $i=2, image will be less clear
 * if $i=3, image will be even clear
 * if $i=4, image will be very partially clear
 * if $i=5, image will be totally blurred
 */ 
?>
<img src="flower.jpg" />
<?php } ?>
</body>
</html>

你可能必须使用PHP的"imagemagick"。其中有很多图像处理方法。您可以对图像使用以下方法,

Imagick::blurImage

有关详细文档,请参阅以下链接。

http://php.net/manual/en/book.imagick.php