计数图像的黑色像素 [英] Count Black Pixels of Image

查看:164
本文介绍了计数图像的黑色像素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用PHP只计算一个PNG图像的黑色像素。没有在网络上发现任何东西。提前感谢!

I am trying to count only the black pixels of a PNG image using PHP. Have not found anything close on the web. Thanks in advance!

推荐答案

您可以使用gd实现。只需使用 imageCreateFromPNG() ,使用 imagesx() imagesy()获取图像大小,然后循环像素,然后 imageColorAt()

You can achieve that using gd. Just open the image with imageCreateFromPNG(), get the image size with imagesx() and imagesy() and then loop over all pixels and do imageColorAt().

这篇关于计数图像的黑色像素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆