php / php/php-src

Bug on colors when loading bitmap file

未关闭
#11,442 5 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

Bug Extension: gd Status: Verified
主要语言
C
星标
40.4k
派生
8.1k
平均合并
2 天 13 小时
30 天内合并 PR
96

描述

Description

Hello,

On some bitmap files, i saw that the color of pixels got with imagecreatefrombmp/imagecolorat/imagecolorsforindex are not the correct one.

To reproduce the issue, just load the image in attachment :

$bmp = imagecreatefrombmp($bitmapFilePath);

then read the color of the pixel in 0,0 :

$rgb = imagecolorat($bmp, 0, 0);
$px = imagecolorsforindex($bmp, $rgb);

You will have the color 0, 248, 0 (green) but the color should be 255,0,255 (magenta).

The bitmap file is correctly displayed on my OS (ubuntu) and in gimp software.

bg1.zip

Here is my php version :

PHP 8.1.2-1ubuntu2.11 (cli) (built: Feb 22 2023 22:56:18) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.2-1ubuntu2.11, Copyright (c), by Zend Technologies
PHP Version

8.1.2

Operating System

Ubuntu 22.04.2 LTS

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

使用附件中的 bg1.zip 文件和 imagecreatefrombmp() 重现报告,然后检查 imagecolorat() 和 imagecolorsforindex() 针对像素 0,0 返回的值。从这些入口点追踪位图加载路径,并将观察到的 RGB 值与预期的洋红色值进行比较;当报告的位图颜色被正确解码时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
c, php
领域
computer-graphics
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。