php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20880 In ImageCopy transparency of the top grafic dominates color of the bottom grafic
Submitted: 2002-12-07 12:03 UTC Modified: 2002-12-08 12:47 UTC
From: rc at opelgt dot org Assigned:
Status: Closed Package: GD related
PHP Version: 4.2.3 OS: Mac OSX 10.2.2
Private report: No CVE-ID: None
 [2002-12-07 12:03 UTC] rc at opelgt dot org
I have two png-files, both with transparency.
With ImageCopy the transparency area of the second graphic will dominate the white area of the first graphic at the bottom.
Example at http://rc.opelgt.org/rechnereien/bug.gif
in the left bottom (origin) of the diagramm:
 Ok: at the left  GD 1.6 with GIFs,
bad: at the right GD 2.0 with PNGs.

With kind regards,
R?diger

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-07 12:36 UTC] rc at opelgt dot org
I have two png-files, both with transparency.
With ImageCopy the transparency area of the second graphic will dominate the white area of the first graphic at the bottom.
Example at http://rc.opelgt.org/rechnereien/bug.gif
in the left bottom (origin) of the diagramm:
   Ok: at the left  GD 1.6 with GIFs,
  bad: at the right GD 2.0 with PNGs.

My suggestion:
a switch to set the behavior
1. transparency of the second leaves the bottom grafic unmodified. Good for my application.
2. transparency of the second grafic dominates the first grafic. Good for perforating the first grafic

With kind regards,
R?diger
 [2002-12-07 15:09 UTC] iliaa@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip

Please use the bundled gd included with the STABLE snapshot.
 [2002-12-07 17:22 UTC] rc at opelgt dot org
Thanks for fast response. What did you mail me?
Source code?
I do not know what to do with it.

Sorry, R?diger
 [2002-12-07 17:34 UTC] iliaa@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip

Download the latest PHP snapshot from the URL in this message and try it.
 [2002-12-07 19:11 UTC] rc at opelgt dot org
Try what?
You have sent me twice the same link.
When I have no C-Compiler (or what kind of source is this?)
what shall I do with it?

R?diger
 [2002-12-07 19:30 UTC] pajoye@php.net
<Try what?>

These 2 links pointed you to the latest development version of php. The 1st link is the linux sources, the 2nd in the windows binary version (which you can use on a windows box as a full replacement of your current installation for tests purpose).

In the case you will test with one these version, please use the bundled gd library (compile with "--with-gd" to get it).

Then can you try to export it as a png image and post an url here ?

pierre


You have sent me twice the same link.
When I have no C-Compiler (or what kind of source is this?)
what shall I do with it?
 [2002-12-07 19:45 UTC] rc at opelgt dot org
Hello Pierre,

as mentioned I have a Mac and using a C-Compiler is beyond my possibilities.

I will wait for 4.3 as a Mac-Version.
R?diger

P.s.: Or do you have a source for a free C-Compiler for Mac OSX?
 [2002-12-07 20:46 UTC] pajoye@php.net
Hello,

A quick test helpfull to find out what happens with your image, can you provide a url (html page) with the 2 original images you use to create the final gif image you provided as a link, and a short script to reproduce it.

About a compiler on a macos platform, you may take a look at:
http://www.phpmac.com/

pierre
 [2002-12-08 02:37 UTC] rc at opelgt dot org
The application is at http://rc.opelgt.org/rechnereien/tacho.html
The two gifs are at http://rc.opelgt.org/rechnereien/diagramm.gif and http://rc.opelgt.org/rechnereien/verdeck.gif
The two pngs are at http://rc.opelgt.org/rechnereien/diagramm.png and http://rc.opelgt.org/rechnereien/verdeck.png
The php code is
<?php
header ("Content-type: image/png");
$im = ImageCreateFromPNG ("diagramm.png")
   or die ("Kann keinen neuen GD-Bild-Stream erzeugen");
$im2 = ImageCreateFromPNG ("verdeck.png");
ImageCopy ($im, $im2, 0, 187, 0, 0, 17, 17);
ImagePNG ($im);
?>
A test html page for easy viewing with dark background
<HTML><HEAD></HEAD>
<BODY BGCOLOR="#990000">
<P><IMG SRC="diagrammping.php" WIDTH=174 HEIGHT=230 ALIGN=bottom></P>
</BODY></HTML>

The two pngs are created with Adobe PhotoShop 6.
I tried to solve the problem with different colors in the two pings marked as transparent (before both #00FF00) but without success.

R?diger
 [2002-12-08 11:56 UTC] pajoye@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.

The current cvs works well with the provided images. Try your script with the cvs version.

Thank's the report,

pierre
 [2002-12-08 12:47 UTC] rc at opelgt dot org
Thank you too ;-)

R?diger
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Sep 04 14:00:01 2025 UTC