--- imagecache.module	2010-05-26 14:08:58.000000000 -0700
+++ imagecache.new.module	2010-09-27 09:43:28.985244500 -0700
@@ -600,6 +600,9 @@ function imagecache_build_derivative($ac
       if (isset($action['data']['yoffset'])) {
         $action['data']['yoffset'] = _imagecache_keyword_filter($action['data']['yoffset'], $image->info['height'], $action['data']['height']);
       }
+      if (isset($action['data']['quality'])) {
+        $qlt = $action['data']['quality'];
+      }
     }
     if (!_imagecache_apply_action($action, $image)) {
       watchdog('imagecache', 'action(id:%id): %action failed for %src', array('%id' => $action['actionid'], '%action' => $action['action'], '%src' => $src), WATCHDOG_ERROR);
@@ -607,7 +610,7 @@ function imagecache_build_derivative($ac
     }
   }
 
-  if (!imageapi_image_close($image, $dst)) {
+  if (!imageapi_image_close($image, $dst, $qlt)) {
     watchdog('imagecache', 'There was an error saving the new image file %dst.', array('%dst' => $dst), WATCHDOG_ERROR);
     return FALSE;
   }
