Index: imageapi_imagemagick.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/imageapi/imageapi_imagemagick.module,v
retrieving revision 1.12
diff -u -p -r1.12 imageapi_imagemagick.module
--- imageapi_imagemagick.module	29 May 2008 02:47:01 -0000	1.12
+++ imageapi_imagemagick.module	29 May 2008 04:42:19 -0000
@@ -129,7 +129,12 @@ function imageapi_imagemagick_image_resi
 }
 
 function imageapi_imagemagick_image_rotate(&$image, $degrees, $bgcolor) {
-  $bgcolor = str_replace('0x', '#', $bgcolor); 
+  if (is_numeric($bgcolor)) {
+    $bgcolor = '#'. str_pad(dechex($bgcolor), 6, 0);
+  }
+  else {
+    $bgcolor = str_replace('0x', '#', $bgcolor);
+  }
   $image->ops[] = '-rotate '. (float) $degrees .' -background '. escapeshellarg($bgcolor) ;
   return true;
 } 
