显示图像的颜色直方图

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.

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

We've been using this one for our projects: http://www.histogramgenerator.com/

We did not experience issues with large images. It's not free, but we definetly feel it's worth the money we paid for. The class also offers many additional interesting features.

Regards