[php-src] Issue #11442: Bug on colors when loading bitmap file

From: Date: Mon, 12 Jun 2023 20:02:33 +0000
Subject: [php-src] Issue #11442: Bug on colors when loading bitmap file
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-244678@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/11442 Author: hoit ### 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](https://github.com/php/php-src/files/11727747/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

« previous php.bugs (#244678) next »