douaoli5328 2015-12-31 10:30
浏览 74

PHP - 模糊图像有更好/更聪明的方法吗? [重复]

This question already has an answer here:

I use gaussian blur. 1 line of

imagefilter($image, IMG_FILTER_GAUSSIAN_BLUR);

doesn't give the desired blur intensity. So I need to use it like 30 times. This is an unprofessional way, it increases the page load time a lot when there are many images on the page. So is there any better/smarter way for image blur ?

  $image = imagecreatefromjpeg("caski_m.jpg");
  imagefilter($image, IMG_FILTER_GAUSSIAN_BLUR);
  header("content-type: image/jpeg");
  imagepng($image);
  imagedestroy($image);
</div>
  • 写回答

1条回答 默认 最新

  • douwaif22244 2015-12-31 10:50
    关注

    If you are searching more concise and elegant solution then:

    1. install ImageMagick extension for php
    2. use php exec command to invoke ImageMagick convert operator:

    Schema: exec("convert <your_image_name> -blur <blur_level> <your_blured_image_name> ");
    You can adjust blur level flexibly.
    Example: exec("convert '$image' -blur 0x8 'blur_' . $image");
    But don't forget to specify accesible image path.
    To get more options look at the following: imagick_blur_guide

    评论

报告相同问题?

悬赏问题

  • ¥15 目详情-五一模拟赛详情页
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b