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);
}
diff --git a/coders/gradient.c b/coders/gradient.c
index f6895bf..c4e09f6 100644
--- a/coders/gradient.c
+++ b/coders/gradient.c
@@ -140,6 +140,8 @@
(void) GradientImage(image,LocaleCompare(image_info->magick,"GRADIENT") == 0 ?
LinearGradient : RadialGradient,PadSpread,&start_color,&stop_color,
exception);
+ if (IssRGBColorspace(image->colorspace) != MagickFalse)
+ (void) SetImageColorspace(image,RGBColorspace,exception);
return(GetFirstImageInList(image));
}