PHP 4.0 Bug #8137 Updated: images are converted to wbmp as a "negative"

From: Date: Sun, 01 Apr 2001 05:47:56 +0000
Subject: PHP 4.0 Bug #8137 Updated: images are converted to wbmp as a "negative"
Groups: php.dev 
Request: Send a blank email to php-dev+get-50460@lists.php.net to get a copy of this message
ID: 8137 Updated by: sniper Reported By: onn@zend.com Old-Status: Open Status: Closed Bug Type: GD related Assigned To: Comments: Fixed in CVS. (fix will be in 4.0.6) --Jani Previous Comments: --------------------------------------------------------------------------- [2000-12-06 12:02:11] onn@zend.com when saving an image as wbmp (imagewbmp) i get the following problems 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 http://www.teraflops.com/wbmp/ - i get the same "negative" result :) the following script demonstrates: <?php $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 ImageWbmp($im,"../tmp/tmp_ImageCreateFromWbmp1.bmp"); // load it from disk $im2 = ImageCreateFromWbmp("../tmp/tmp_ImageCreateFromWbmp1.bmp"); // save as jpeg and wbmp again ImageWbmp($im2,"../tmp/tmp_ImageCreateFromWbmp2.bmp"); ImageJpeg($im2,"../tmp/tmp_ImageCreateFromWbmp3.jpeg"); ImageDestroy($im); ImageDestroy($im2); ?> 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: _php_image_output_wbmp. 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??) ONn --------------------------------------------------------------------------- ATTENTION! Do NOT reply to this email! To reply, use the web interface found at http://bugs.php.net/?id=8137&edit=2

« previous php.dev (#50460) next »