我正在尝试找出一种仅对图像的一部分进行像素化的方法,但到目前为止还没有成功。
目前我正在关注以下本教程: http: //www.mutinydesign.co.uk/free-scripts/live-photo-blurring-script/
使用 jQuery 插件“imgAreaSelect”让用户可以从 UI 中选择部分图片。然后点击“像素化”。然后,这会对用 php 为 imagemagick 编写的像素化函数进行 ajax 调用。像素化函数如下所示:
<?php
$x1 = $_GET['x1'];
$y1 = $_GET['y1'];
$x2 = $_GET['x2'];
$y2 = $_GET['y2'];
$inputImage = $_GET['inputImage'];
$outputImage = 'output_'.$_GET['inputImage'];
exec( "convert {$inputImage} \( +clone -scale 20% -scale 500% \) \
\( +clone -gamma 0 -fill white \
-draw 'rectangle {$x1},{$y1} {$x2},{$y2}' -blur 10x4 \) \
-composite {$outputImage}" );
echo $outputImage;
?>
这确实有效,但它使整个图像像素化,而不仅仅是选定的部分。任何想法或建议表示赞赏。有没有人能够完成类似的事情?