Index: imageapi.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/imageapi/imageapi.module,v
retrieving revision 1.15.2.3
diff -u -p -r1.15.2.3 imageapi.module
--- imageapi.module	29 May 2008 02:47:28 -0000	1.15.2.3
+++ imageapi.module	6 Jun 2008 02:54:12 -0000
@@ -269,6 +269,16 @@ function imageapi_image_crop(&$image, $x
   if (empty($height)) $height = $width / $aspect;
   if (empty($width)) $width = $height * $aspect;
 
+  // Ensure target image size is not greater than original size.
+  if ($width > $image->info['width']) {
+    $width = $image->info['width'];
+    $x = 0;
+  }
+  if ($height > $image->info['height']) {
+    $height = $image->info['height'];
+    $y = 0;
+  }
+
   return call_user_func($image->toolkit .'_image_crop', $image, $x, $y, $width, $height);
 }
  
