php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #24585 imagecopymergegray
Submitted: 2003-07-10 05:37 UTC Modified: 2003-08-08 04:10 UTC
From: eric at pitte dot de Assigned:
Status: Closed Package: Documentation problem
PHP Version: 4.3.2 OS: Suse 8.2
Private report: No CVE-ID: None
 [2003-07-10 05:37 UTC] eric at pitte dot de
Description:
------------
I see a problem with the imagecopymergegray funktion.
It does not seems to be possible to make grayscale from a png color image.
See my code. Spion.png is a color image and spion2 should be a grayscale one, but the result is also a color picture.
Is this problem known ?

Reproduce code:
---------------
<?php

    $pic = imageCreateFrompng("spion.png");

    imagecopymergegray($pic,$pic,0,0,0,0,500,500,20);
    imagepng($pic,"spion2.png");
    imagedestroy($pic);

?>


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-07-10 12:23 UTC] sniper@php.net
That spong.png image would be nice to have. Put it online somewhere or give link to any png file that produces the same problem.

 [2003-07-10 12:33 UTC] eric at pitte dot de
i send you directly one of the pix i tryied to convert to greyscale.
 [2003-07-10 12:53 UTC] sniper@php.net
Do NOT send me any mails!!

Put the image online somewhere or find some online image that we can use that produces the same problem.

 [2003-07-10 13:02 UTC] eric at pitte dot de
ok sorry for the email.
Here an URL with the picture
http://www.pitte.linux-site.net/php/index.htm
 [2003-07-10 15:49 UTC] sniper@php.net
I do get propably the same result, but whether it's the wrong behaviour remains to be decided by someone else. :)

 [2003-08-08 04:10 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

imagecopymergegray is not a function to copy an image as grayscale or anything like that.

This function merges the src images to the dst image. It preserveses the hue of the source by converting the destination pixels to gray scale before the copy operation.

pierre

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