donglie9067 2013-06-17 21:20
浏览 155
已采纳

从PHP的.gd或.gd2格式读取原始颜色数据?

In another question I saw some source, that would export an image into .gd or .gd2 format and then read raw pixel color data from the generated source.

Is this possible? Where can I find more information about these formats, or any other, that generates a raw pixel color data sequence of some sort?

My final goal is quite simple actually. I would like to read the color data of all pixels of an image (say 1000px by 1000px), without having to call imagecolorat a gazillion times :)

  • 写回答

1条回答 默认 最新

  • duanci6484 2013-06-20 08:09
    关注

    It's certainly possible. I've used the technique in a project. What the code does is add alpha channel information from a separate to an image. Something dead simple, but would be insanely slow using imagecolorat() and imagesetpixel().

    The data is a read bear to work with. The image is divided into tiles, so getting the pixel at a given set of coordinates is a little tricky.

    The information about the format came entirely from looking at the source code. I don't believe there's any other documentation.

    The difficulty of directly manipulating pixels in standard PHP was the motivation behind the creation of the QB extension. It lets you do this kind of work at much more reasonable speed. Normalization of pixels into floating point vectors also simplifies calculation a great deal. Might be worth your while to look into.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
  • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)
  • ¥20 matlab yalmip kkt 双层优化问题
  • ¥15 如何在3D高斯飞溅的渲染的场景中获得一个可控的旋转物体
  • ¥88 实在没有想法,需要个思路
  • ¥15 MATLAB报错输入参数太多
  • ¥15 python中合并修改日期相同的CSV文件并按照修改日期的名字命名文件
  • ¥15 有赏,i卡绘世画不出
  • ¥15 如何用stata画出文献中常见的安慰剂检验图
  • ¥15 c语言链表结构体数据插入