diff --git a/canvasactions.inc b/canvasactions.inc
old mode 100755
new mode 100644
index 0db5e64..a27b946
--- a/canvasactions.inc
+++ b/canvasactions.inc
@@ -22,7 +22,7 @@
  */
 function canvasactions_definecanvas_form($action) {
   if (imageapi_default_toolkit() != 'imageapi_gd') {
-    drupal_set_message('Define Canvas not currently supported by using imagemagick. This effect requires GD image toolkit only.', 'warning');
+//     drupal_set_message('Define Canvas not currently supported by using imagemagick. This effect requires GD image toolkit only.', 'warning');
   }
   $defaults = array(
     'RGB' => array(
@@ -295,26 +295,34 @@ function imageapi_gd_image_definecanvas(&$image, $action = array()) {
  *
  * $targetsize is an array expected to contain a width,height and a left,top
  * offset.
+ *
+ * Patched with code at issue http://drupal.org/node/844386
  */
 function imageapi_imagemagick_image_definecanvas(&$image, $action = array()) {
   $targetsize = $action['targetsize'];
   $RGB = $action['RGB'];
+  $backgroundcolor = $RGB['HEX'] != '' ? '#'. $RGB['HEX'] : 'None';
 
   # TODO needs work.
   #
-  $crop = " -background '#{$RGB['HEX']}' -crop   '{$targetsize['width']}x{$targetsize['height']}-{$targetsize['left']}-{$targetsize['top']}!' ";
-  $draw = '';
+  $background = " -background '{$backgroundcolor}' ";
+  $crop = " -crop   '{$targetsize['width']}x{$targetsize['height']}-{$targetsize['left']}-{$targetsize['top']}!' ";
 
   $draw = " -draw '";
-  $draw .= " fill '#{$RGB['HEX']}' polygon 0,0 {$targetsize['width']},0 {$targetsize['width']},{$targetsize['height']} 0,{$targetsize['height']} ";
+  $draw .= " fill '{$RGB['HEX']}' polygon 0,0 {$targetsize['width']},0 {$targetsize['width']},{$targetsize['height']} 0,{$targetsize['height']} ";
   $draw .= " ' ";
   #$draw .= " -composite ";
   $draw .= " +repage ";
 
-  $compose = " $crop $draw ";
+  $extent = " -extent '{$targetsize['width']}x{$targetsize['height']}-{$targetsize['left']}-{$targetsize['top']}!'";
+  if ($action['under']) {
+    $compose = " $background $crop $extent ";
+  }
+  else {
+    $compose = " $background $crop $draw ";
+  }
   $image->ops[] = $compose;
   return TRUE;
-  
 }
 
 
diff --git a/utility.inc b/utility.inc
old mode 100755
new mode 100644
index 99fc872..b731c60
--- a/utility.inc
+++ b/utility.inc
@@ -80,7 +80,7 @@ function imagecache_actions_validate_alpha(&$element, &$form_status) {
 /**
  * Render the subform in a table
  */
-function theme_imagecacheactions_rgb_form(&$form) {
+function theme_imagecacheactions_rgb_form($form) {
   // Add a farb element
   drupal_add_css('misc/farbtastic/farbtastic.css', 'module', 'all', FALSE);
   drupal_add_js('misc/farbtastic/farbtastic.js');
