--- image.imagemagick.inc.orig	2010-08-03 12:43:00.000000000 -0500
+++ image.imagemagick.inc	2011-03-05 21:35:15.000000000 -0600
@@ -105,7 +105,7 @@
 function image_imagemagick_rotate($source, $dest, $degrees, $bg_color = 0x000000) {
   $args = array(
     'rotate' => '-rotate ' . (float) $degrees,
-    'background' => '-background #' . str_pad(dechex($bg_color), 6, 0),
+    'background' => '-background "#' . str_pad(dechex($bg_color), 6, 0) . '"',
   );
   $args = _image_imagemagick_alter_invoke('rotate', $source, $args);
   return _image_imagemagick_convert($source, $dest, $args);
@@ -125,7 +125,7 @@
  */
 function _image_imagemagick_convert($source, $dest, $args) {
   $command = implode(' ', array(
-    preg_replace("/[^A-Za-z0-9\!\.\-\+\_\/\040]/", '', implode(' ', $args)),
+    preg_replace('/[^#"A-Za-z0-9\!\.\-\+\_\/\040]/', '', implode(' ', $args)),
     escapeshellarg($source),
     escapeshellarg($dest),
   ));
