Index: imagecache_actions.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/imagecache/imagecache_actions.inc,v
retrieving revision 1.17
diff -u -p -r1.17 imagecache_actions.inc
--- imagecache_actions.inc	8 Oct 2008 01:32:23 -0000	1.17
+++ imagecache_actions.inc	6 Jan 2009 22:00:52 -0000
@@ -206,7 +206,7 @@ function imagecache_rotate_form($data) {
     '#type' => 'textfield',
     '#default_value' => (isset($data['bgcolor'])) ? $data['bgcolor'] : '#FFFFFF',
     '#title' => t('Background color'),
-    '#description' => t('The background color to use for exposed areas of the image. Use web-style hex colors (#FFFFFF for white, #000000 for black).'),
+    '#description' => t('The background color to use for exposed areas of the image. Use web-style hex colors (#FFFFFF for white, #000000 for black). Use -1 for transparent, but only for PNGs or other transparency effects.'),
   );
   return $form;
 }
@@ -222,10 +222,17 @@ function imagecache_rotate_image(&$image
   // Set sane default values.
   $data['degrees'] = $data['degrees'] ? $data['degrees'] : 0;
   $data['random'] = $data['random'] ? $data['random'] : false;
-  $data['bgcolor'] = $data['bgcolor'] ? $data['bgcolor'] : '#FFFFFF';
 
-  // Manipulate the if we need to randomize, and convert to proper colors.
-  $data['bgcolor'] = '0x'. str_replace('#', '', $data['bgcolor']);
+  // -1 indicates transparency
+  if($data['bgcolor'] != -1) {
+    $data['bgcolor'] = $data['bgcolor'] ? $data['bgcolor'] : '#FFFFFF';
+    // Convert to a proper number
+    $data['bgcolor'] = '0x'. str_replace('#', '', $data['bgcolor']);
+  }
+  else {
+    imagesavealpha($image->res, TRUE);
+    imagealphablending($image->res, FALSE);
+  }
 
   if (!empty($data['random'])) {
     $degrees = abs((float)$data['degrees']);
