From: me at thomaskeller dot biz Operating system: Linux 2.4 shared hosting PHP version: 4.3.11 PHP Bug Type: GD related Bug description: Resizing palette based images with transparency bit loose transparency
Description: ------------ Following use case: Uploaded images should be shrinked to a certain size according to our guidelines. Works with jpeg/ png (not palette based) images without a problem, problems arise when used palette based (8bit) images. Resizing via imagecopyresampled/ imagecopyresize works only for images WITHOUT a transparency color set properly. If a transparency color is set in the image, the value of this color is just ignored and a random background color is applied to the "transparent" area. It makes no difference if the image is outputted as gif or 8bit png. If imagecopyresampled/imagecopyresized is called with the same width/height for the source and the target image, the transparency keeps intact. Reproduce code: --------------- I've setuped a few things on a test server: PHPInfo: http://thomaskeller.biz/work/php/PHP_GIF/info.php Testfile: http://thomaskeller.biz/work/php/PHP_GIF/image.php Testfile (Source): http://thomaskeller.biz/work/php/PHP_GIF/image.phps image.php loads http://thomaskeller.biz/work/php/PHP_GIF/rose.gif by default, but you can load an own gif file via URL like image.php?filename=http://your.server.com/file.gif The loaded image is per default resized to its double width/ height. -- Edit bug report at http://bugs.php.net/?id=33914&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33914&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33914&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33914&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=33914&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=33914&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=33914&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=33914&r=needscript Try newer version: http://bugs.php.net/fix.php?id=33914&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=33914&r=support Expected behavior: http://bugs.php.net/fix.php?id=33914&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=33914&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=33914&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=33914&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33914&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=33914&r=dst IIS Stability: http://bugs.php.net/fix.php?id=33914&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=33914&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=33914&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=33914&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=33914&r=mysqlcfg