Index: imageapi_gd.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/imageapi/imageapi_gd.module,v retrieving revision 1.13.2.7 diff -u -p -r1.13.2.7 imageapi_gd.module --- imageapi_gd.module 17 Apr 2009 00:15:21 -0000 1.13.2.7 +++ imageapi_gd.module 21 May 2010 11:57:57 -0000 @@ -246,7 +246,7 @@ function imageapi_gd_create_tmp($image, // Grab transparent color index from image resource. $transparent = imagecolortransparent($image->resource); - if ($transparent >= 0) { + if ($transparent >= 0 && $transparent < imagecolorstotal($image->resource)) { // The original must have a transparent color, allocate to the new image. $transparent_color = imagecolorsforindex($image->resource, $transparent); $transparent = imagecolorallocate($res, $transparent_color['red'], $transparent_color['green'], $transparent_color['blue']);