php.net |  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: onn at zend dot com
New email:
PHP Version: OS:

 

 [2000-12-06 12:02 UTC] onn at zend dot 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


Patches

Pull Requests

History

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

--Jani

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 05 21:01:31 2024 UTC