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 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)
  • ¥15 相敏解调 matlab
  • ¥15 求lingo代码和思路
  • ¥15 公交车和无人机协同运输
  • ¥15 stm32代码移植没反应
  • ¥15 matlab基于pde算法图像修复,为什么只能对示例图像有效
  • ¥100 连续两帧图像高速减法
  • ¥15 如何绘制动力学系统的相图
  • ¥15 对接wps接口实现获取元数据