#26144 [Opn]: ImageRotate() inverts/blacks the alpha channel
ID: 26144 User updated by: sprice at wisc dot edu Reported By: sprice at wisc dot edu Status: Open Bug Type: GD related Operating System: Mac 10.3 PHP Version: 4.3.4 New Comment: After looking through the source code more, I think that this is caused (at least in part) by always converting the rotated image to a true color image, which always initially has the background color of black. This is also why the background color argument of the imageRotate() function seems to have no effect. This is shown in /ext/gd/libgd/gd.c on lines 2654, 2691, and 2728 (among others). I think a fix to this would be to make GD return a true color image only when the input is true color. Otherwise return an image with palette biased colors. This *should* keep the alpha channel a bit more intact than previously. Don't expect a patch from me any time soon though, because I have homework and classes now, and I only know enough C to be dangerous... Previous Comments: [2003-11-05 21:46:56] sprice at wisc dot edu ./configure --with-apxs --with-mysql --with-gd --with- png-dir=/usr/local --with-zlib-dir=/usr --with-jpeg- dir=/usr/local --disable-short-tags (and phpinfo() says it is the bundled, 2.0.15 compat. version) Is this not reproducible? [2003-11-05 21:39:11] [EMAIL PROTECTED] And what might have been the configure line you used? If you didn't use the bundled GD library, bogus this yourself.. [2003-11-05 19:46:04] sprice at wisc dot edu Tried it with latest/greatest CVS (php4-STABLE -200311060030) and it is still broken. [2003-11-05 17:55:24] [EMAIL PROTECTED] 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. [2003-11-05 17:52:49] sprice at wisc dot edu Description: ImageRotate() is messing with my alpha channel. Examples to follow. Reproduce code: --- ?php header( 'Content-type: image/png' ); $img = ImageCreate(100, 60); $white = ImageColorResolve($img, 255, 255, 255); $almost_clear = ImageColorResolveAlpha($img, 1, 1, 250, 63); ImageFilledRectangle($img, 0, 0, 50, 30, $white); ImageFilledRectangle($img, 10, 10, 100, 60, $almost_clear); ImagePNG($img); // This works //ImagePNG(ImageRotate($img, 90, $almost_clear)); // This is all black ? Expected result: When you run this as is, you get a semitransparent blue rectangle. Actual result: -- If you replace the commented out ImagePNG() with the commented one, the alpha channel inverts itself. As you increase the transparency of $almost_clear, it becomes black (in contrast to the non- ImageRotate() line). -- Edit this bug report at http://bugs.php.net/?id=26144edit=1
#26144 [NEW]: ImageRotate() inverts/blacks the alpha channel
From: sprice at wisc dot edu Operating system: Mac 10.3 PHP version: 4.3.4 PHP Bug Type: GD related Bug description: ImageRotate() inverts/blacks the alpha channel Description: ImageRotate() is messing with my alpha channel. Examples to follow. Reproduce code: --- ?php header( 'Content-type: image/png' ); $img = ImageCreate(100, 60); $white = ImageColorResolve($img, 255, 255, 255); $almost_clear = ImageColorResolveAlpha($img, 1, 1, 250, 63); ImageFilledRectangle($img, 0, 0, 50, 30, $white); ImageFilledRectangle($img, 10, 10, 100, 60, $almost_clear); ImagePNG($img); // This works //ImagePNG(ImageRotate($img, 90, $almost_clear)); // This is all black ? Expected result: When you run this as is, you get a semitransparent blue rectangle. Actual result: -- If you replace the commented out ImagePNG() with the commented one, the alpha channel inverts itself. As you increase the transparency of $almost_clear, it becomes black (in contrast to the non- ImageRotate() line). -- Edit bug report at http://bugs.php.net/?id=26144edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=26144r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=26144r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=26144r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=26144r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=26144r=needtrace Try newer version: http://bugs.php.net/fix.php?id=26144r=oldversion Not developer issue:http://bugs.php.net/fix.php?id=26144r=support Expected behavior: http://bugs.php.net/fix.php?id=26144r=notwrong Not enough info:http://bugs.php.net/fix.php?id=26144r=notenoughinfo Submitted twice:http://bugs.php.net/fix.php?id=26144r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=26144r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26144r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=26144r=dst IIS Stability: http://bugs.php.net/fix.php?id=26144r=isapi Install GNU Sed:http://bugs.php.net/fix.php?id=26144r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=26144r=float
#26144 [Csd-Opn]: ImageRotate() inverts/blacks the alpha channel
ID: 26144 User updated by: sprice at wisc dot edu Reported By: sprice at wisc dot edu -Status: Closed +Status: Open Bug Type: GD related Operating System: Mac 10.3 PHP Version: 4.3.4 New Comment: Tried it with latest/greatest CVS (php4-STABLE -200311060030) and it is still broken. Previous Comments: [2003-11-05 17:55:24] [EMAIL PROTECTED] 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. [2003-11-05 17:52:49] sprice at wisc dot edu Description: ImageRotate() is messing with my alpha channel. Examples to follow. Reproduce code: --- ?php header( 'Content-type: image/png' ); $img = ImageCreate(100, 60); $white = ImageColorResolve($img, 255, 255, 255); $almost_clear = ImageColorResolveAlpha($img, 1, 1, 250, 63); ImageFilledRectangle($img, 0, 0, 50, 30, $white); ImageFilledRectangle($img, 10, 10, 100, 60, $almost_clear); ImagePNG($img); // This works //ImagePNG(ImageRotate($img, 90, $almost_clear)); // This is all black ? Expected result: When you run this as is, you get a semitransparent blue rectangle. Actual result: -- If you replace the commented out ImagePNG() with the commented one, the alpha channel inverts itself. As you increase the transparency of $almost_clear, it becomes black (in contrast to the non- ImageRotate() line). -- Edit this bug report at http://bugs.php.net/?id=26144edit=1
#26144 [Fbk-Opn]: ImageRotate() inverts/blacks the alpha channel
ID: 26144 User updated by: sprice at wisc dot edu Reported By: sprice at wisc dot edu -Status: Feedback +Status: Open Bug Type: GD related Operating System: Mac 10.3 PHP Version: 4.3.4 New Comment: ./configure --with-apxs --with-mysql --with-gd --with- png-dir=/usr/local --with-zlib-dir=/usr --with-jpeg- dir=/usr/local --disable-short-tags (and phpinfo() says it is the bundled, 2.0.15 compat. version) Is this not reproducible? Previous Comments: [2003-11-05 21:39:11] [EMAIL PROTECTED] And what might have been the configure line you used? If you didn't use the bundled GD library, bogus this yourself.. [2003-11-05 19:46:04] sprice at wisc dot edu Tried it with latest/greatest CVS (php4-STABLE -200311060030) and it is still broken. [2003-11-05 17:55:24] [EMAIL PROTECTED] 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. [2003-11-05 17:52:49] sprice at wisc dot edu Description: ImageRotate() is messing with my alpha channel. Examples to follow. Reproduce code: --- ?php header( 'Content-type: image/png' ); $img = ImageCreate(100, 60); $white = ImageColorResolve($img, 255, 255, 255); $almost_clear = ImageColorResolveAlpha($img, 1, 1, 250, 63); ImageFilledRectangle($img, 0, 0, 50, 30, $white); ImageFilledRectangle($img, 10, 10, 100, 60, $almost_clear); ImagePNG($img); // This works //ImagePNG(ImageRotate($img, 90, $almost_clear)); // This is all black ? Expected result: When you run this as is, you get a semitransparent blue rectangle. Actual result: -- If you replace the commented out ImagePNG() with the commented one, the alpha channel inverts itself. As you increase the transparency of $almost_clear, it becomes black (in contrast to the non- ImageRotate() line). -- Edit this bug report at http://bugs.php.net/?id=26144edit=1
#26097 [NEW]: GD gdImageColorClosest() and gdImageColorClosestAlpha() not correct
From: sprice at wisc dot edu Operating system: Mac 10.3 PHP version: 4.3.3 PHP Bug Type: GD related Bug description: GD gdImageColorClosest() and gdImageColorClosestAlpha() not correct Description: I submitted this to the maintainer of GD and he said that there is a patch for this coming in GD 2.16. It is a somewhat obvious bug, so I won't waste time coding up examples (if you still want examples, say so...). In gd.c (ext/gd/libgd/gd.c) line 258 says ad = im- blue[i] - a; but it should say ad = im-alpha[i] - a;. -- Edit bug report at http://bugs.php.net/?id=26097edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=26097r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=26097r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=26097r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=26097r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=26097r=needtrace Try newer version: http://bugs.php.net/fix.php?id=26097r=oldversion Not developer issue:http://bugs.php.net/fix.php?id=26097r=support Expected behavior: http://bugs.php.net/fix.php?id=26097r=notwrong Not enough info:http://bugs.php.net/fix.php?id=26097r=notenoughinfo Submitted twice:http://bugs.php.net/fix.php?id=26097r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=26097r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26097r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=26097r=dst IIS Stability: http://bugs.php.net/fix.php?id=26097r=isapi Install GNU Sed:http://bugs.php.net/fix.php?id=26097r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=26097r=float
#26097 [Opn]: (easy fix) GD gdImageColorClosest() and gdImageColorClosestAlpha() not correct
ID: 26097 User updated by: sprice at wisc dot edu -Summary: GD gdImageColorClosest() and gdImageColorClosestAlpha() not correct Reported By: sprice at wisc dot edu Status: Open Bug Type: GD related Operating System: Mac 10.3 PHP Version: 4.3.3 New Comment: BTW: this exists in 4.3.4 RC3 Previous Comments: [2003-11-03 13:43:11] sprice at wisc dot edu Description: I submitted this to the maintainer of GD and he said that there is a patch for this coming in GD 2.16. It is a somewhat obvious bug, so I won't waste time coding up examples (if you still want examples, say so...). In gd.c (ext/gd/libgd/gd.c) line 258 says ad = im- blue[i] - a; but it should say ad = im-alpha[i] - a;. -- Edit this bug report at http://bugs.php.net/?id=26097edit=1
#25526 [NEW]: call_user_func_array corrupts the passed array
From: sprice at wisc dot edu Operating system: OS X 10.2.6 PHP version: 4.3.3 PHP Bug Type: Unknown/Other Function Bug description: call_user_func_array corrupts the passed array Description: call_user_func_array seems to corrupt the array that is passed to the user function through it. If an array of two strings are passed, and you try to print $strings[0] you get the first letter of the first element. If you try to print $strings[1] you get the 2nd letter of the first element. Reproduce code: --- ?php function test($testing){ echo $testing[1]; } $array = array('im testing', 'hello?'); call_user_func_array('test', $array); echo \n; echo $array[1]; ? Expected result: hello? hello? Actual result: -- m hello? -- Edit bug report at http://bugs.php.net/?id=25526edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=25526r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=25526r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=25526r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=25526r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=25526r=needtrace Try newer version: http://bugs.php.net/fix.php?id=25526r=oldversion Not developer issue:http://bugs.php.net/fix.php?id=25526r=support Expected behavior: http://bugs.php.net/fix.php?id=25526r=notwrong Not enough info:http://bugs.php.net/fix.php?id=25526r=notenoughinfo Submitted twice:http://bugs.php.net/fix.php?id=25526r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=25526r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25526r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=25526r=dst IIS Stability: http://bugs.php.net/fix.php?id=25526r=isapi Install GNU Sed:http://bugs.php.net/fix.php?id=25526r=gnused