|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #8137 images are converted to wbmp as a "negative"
Submitted: 2000-12-06 12:02 UTC Modified: 2001-04-01 00:47 UTC
From: onn at zend dot com Assigned:
Status: Closed Package: GD related
PHP Version: 4.0 Latest CVS (06/12/2000) OS: linux (7.0)
Private report: No CVE-ID: None
 [2000-12-06 12:02 UTC] onn at zend dot com
when saving an image as wbmp (imagewbmp) i get the following

1) if i load the image and then save it again as a jpeg,
then i will get a negative of the original.

2) when viewing the wbmp file - i viewed it at - i get the same "negative"
result :)

the following script demonstrates:


    $im = ImageCreate(200, 200);
    $black = ImageColorAllocate($im,0,0,0);
    $white = ImageColorAllocate($im,255,255,255);

    ImageLine($im, 0, 0, 199, 199, $white);
// create the wmbp file

// load it from disk
$im2 =

// save as jpeg and wbmp again



i would expect to see white diagnol across a black
backgrouond, but what i get the opposite - black diagonal
across a white background

the problem seems to be in the function:

the following code
if(im->pixels[y][x] == 0) c = c | (1 << (7-p));
should be (i think)
if(im->pixels[y][x] != 0) c = c | (1 << (7-p));

(a != instead of an ==)

this gets the jpeg to be displayed correctly, but the wbmp
is still backwards (therefore not a complete fix??)



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-04-01 00:47 UTC]
Fixed in CVS. (fix will be in 4.0.6)


PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 25 14:01:32 2024 UTC