显示图像的颜色直方图

时间:2022-01-09 17:06:20

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).

我在PHP中搜索一个函数,它将直方图从图像提取到PNG文件。此PNG文件将位于与实际图像不同的文件夹中,并且该功能必须处理大图像(超过3 MB)。我确实找到了一个几乎与我的请求类似的功能但功能无法处理大图像,它没有显示直方图,也没有显示在他们的网站上显示的图像(它只显示带边框的空白窗口)。

I hope that you guys can help me with this.

我希望你们可以帮助我。

Thanks in advance.

提前致谢。

2 个解决方案

#1


0  

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

我们一直在为我们的项目使用这个: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

问候

#2


-1  

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

我用2MB(5800 x 5800)PNG图像测试了这个。基本上,“imagecreatefrompng()”方法占用大量内存。

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

因此,在进行调用之前,我将内存增加到512M,并将执行时间设置为5分钟

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

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

#1


0  

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

我们一直在为我们的项目使用这个: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

问候

#2


-1  

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

我用2MB(5800 x 5800)PNG图像测试了这个。基本上,“imagecreatefrompng()”方法占用大量内存。

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

因此,在进行调用之前,我将内存增加到512M,并将执行时间设置为5分钟

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

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