diff --git a/MagickCore/channel.c b/MagickCore/channel.c
index 111a339..f01f11d 100644
--- a/MagickCore/channel.c
+++ b/MagickCore/channel.c
@@ -269,11 +269,6 @@
Image
*canvas;
- if ((channel_op == ExtractChannelOp) && (channels == 1))
- {
- destination_image->colorspace=GRAYColorspace;
- InitializePixelChannelMap(destination_image);
- }
status=SetImageStorageClass(destination_image,DirectClass,exception);
if (status == MagickFalse)
{
@@ -342,6 +337,8 @@
return(destination_image);
}
destination_channel=(PixelChannel) i;
+ if (LocaleCompare(token,"gray") == 0)
+ (void) SetImageAlpha(destination_image,GrayColorspace,exception);
if ((LocaleCompare(token,"black") == 0) ||
(LocaleCompare(token,"c") == 0) ||
(LocaleCompare(token,"cyan") == 0) ||
@@ -393,11 +390,6 @@
if (status == MagickFalse)
break;
}
- if ((channel_op == ExtractChannelOp) && (channels == 1))
- {
- destination_image->colorspace=GRAYColorspace;
- InitializePixelChannelMap(destination_image);
- }
status=SetImageStorageClass(destination_image,DirectClass,exception);
if (status == MagickFalse)
{