Re: [GD-DEVEL] Problems copying PNG with Alpha-Transparency

From: Date: Wed, 15 Jul 2009 08:33:45 +0000
Subject: Re: [GD-DEVEL] Problems copying PNG with Alpha-Transparency
References: 1 2  Groups: php.gd.devel 
Request: Send a blank email to php-gd-devel+get-588@lists.php.net to get a copy of this message
Hello Pierre, hope 14k for the PNG-File are ok. Below the C-Code I've used for generating the attached file. As "PNG_transparency_demonstration_1.png" I used the Demonstration-Image which you can get here: <http://de.wikipedia.org/w/index.php?title=Datei:PNG_transparency_demonstration_1.png&filetimestamp=20090422121649> Rgds. Dieter ========== gdImagePtr dest, sourceGd; FILE *pngout, *sourcefile; int white; sourcefile = fopen( "PNG_transparency_demonstration_1.png", "rb" ); sourceGd = gdImageCreateFromPng( sourcefile ); fclose( sourcefile ); dest = gdImageCreate( 840, 640 ); white = gdImageColorAllocate( dest, 255, 255, 255 ); gdImageCopy( dest, sourceGd, 20, 20, 0, 0, gdImageSX( sourceGd ), gdImageSY( sourceGd ) ); pngout = fopen( "result.png", "wb" ); gdImagePngEx( dest, pngout, 9 ); fclose( pngout ); gdImageDestroy( dest ); gdImageDestroy( sourceGd ); Pierre Joye schrieb: > Please show the result images too and the application or script you > use to generate them (small if possible) > > On Tue, Jul 14, 2009 at 5:11 PM, Dieter Guthmann<mailing-deg@bup-nbg.de> wrote: > >> Hello, >> >> I've tested today copying a PNG-File with Alpha-Transparency to an image >> (new, empty) with libgd. The result doesn't look beautiful... some parts >> of the half-transparent areas are missing, and the background in the >> target-Image looks like chessboard. >> I've used gdImageCopy and gdImageCopyResampled but the results are the >> same. Is copying of PNGs with Alpha-Transparency currently not >> implemented or do I have to use another function for that purpose? >> >> The image I've tested with is here: >> <<0@‘|gqŶª >> ®1ì9http://de.wikipedia.org/w/index.php?title=Datei:PNG_transparency_demonstration_1.png&filetimestamp=20090422121649> >>

« previous php.gd.devel (#588) next »