douzuanze0486 2011-11-20 05:00
浏览 645

显示图像的颜色直方图

I'm searching for a function in PHP which extract the histogram from an image to an PNG file. This PNG file will be located in a different folder than the actual image and the function must handle large images (over 3 MB). I did find a function almost similar to my request but the function can not handle large images and it didn't showed the histogram nor the image as showed on their website (it showed only a blank window with a border).

I hope that you guys can help me with this.

Thanks in advance.

  • 写回答

2条回答 默认 最新

  • douqie1852 2011-11-20 06:28
    关注

    I tested this with a 2MB (5800 x 5800) PNG Image. Basicaly the "imagecreatefrompng()" method is consuming lot of memory.

    So before making the call, I increased the memory al the way up to 512M and set the execution time to 5 mins

    ini_set('memory_limit', '512M');
    set_time_limit(5*60);
    

    After the Image is created, restore the memory limit

    $im = ImageCreateFromPng($source_file); 
    ini_restore('memory_limit');
    

    Reference: http://www.php.net/manual/en/function.imagecreatefrompng.php#73546

    评论

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题