php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27934 Images computed by GD Library incorrect
Submitted: 2004-04-09 12:46 UTC Modified: 2004-04-09 12:51 UTC
From: new at springtimesoftware dot com Assigned:
Status: Not a bug Package: GD related
PHP Version: 4.3.5 OS: Linux
Private report: No CVE-ID: None
 [2004-04-09 12:46 UTC] new at springtimesoftware dot com
Description:
------------
Hi. I think I'm encountering an error in the GD Library. This happens in PHP Version 4.3.5 running on Linux but does not happen in Version 4.1.2 running on Windows 98.

Please download and unzip http://www.springtimesoftware.com/public/gd-error-bmp.zip . This file contains a bitmap file that shows two images. The top image, a picture of a building, was generated by browsing to the file gd-error-jpg.php (see below) on my local computer (system "localhost").

The second image is generated by browsing to the same file located on a remote server, at address http://www.springtimesoftware.com/public/gd-error-jpg.php .

Note that the second image appears to be grayed, which is an error. I've localized the error to the "imagecopy" function. I don't have the source files, so I can't debug.

You can browse to http://www.springtimesoftware.com/public/bldg.jpg to see the original image which is processed by gd-error-jpg.php.

I thought that bldg.jpg might have an incorrect format, but using sunset.jpg, which was generated by a different program, also results in an error (the image is black this time).

Here are the contents of the gd-error-jpg.php file:

<?
Header("Content-Type: image/jpeg");
$file = "bldg.jpg";
$Size = getimagesize($file);
$w = $Size[0];
$h = $Size[1];
$im = ImageCreate($w, $h);
$pic = imagecreatefromjpeg($file);
imagecopy($im, $pic, 0, 0, 0, 0, $w, $h);

ImageJPEG($im);
ImageDestroy($pic);
ImageDestroy($im);
?>

Thanks,
David



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-09 12:51 UTC] pajoye@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Use imagecreatetruecolor to work true color images else you will with only 256 colors (incl. background).


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 16 18:01:31 2025 UTC