diff --git a/MagickCore/paint.c b/MagickCore/paint.c
index 687b08f..96516e5 100644
--- a/MagickCore/paint.c
+++ b/MagickCore/paint.c
@@ -455,13 +455,13 @@
/*
Draw a gradient on the image.
*/
+ if ((start_color->matte == MagickFalse) && (stop_color->matte == MagickFalse))
+ image->matte=MagickFalse;
+ (void) SetImageColorspace(image,start_color->colorspace,exception);
status=DrawGradientImage(image,draw_info,exception);
draw_info=DestroyDrawInfo(draw_info);
if ((start_color->matte == MagickFalse) && (stop_color->matte == MagickFalse))
image->matte=MagickFalse;
- if ((IsPixelInfoGray(start_color) != MagickFalse) &&
- (IsPixelInfoGray(stop_color) != MagickFalse))
- SetImageColorspace(image,GRAYColorspace,exception);
return(status);
}