Fixed hasChannel for gray images.
diff --git a/Magick++/lib/Image.cpp b/Magick++/lib/Image.cpp
index 559fc00..830c7bc 100644
--- a/Magick++/lib/Image.cpp
+++ b/Magick++/lib/Image.cpp
@@ -962,7 +962,13 @@
bool Magick::Image::hasChannel(const PixelChannel channel) const
{
- return (GetPixelChannelTraits(constImage(),channel) != UndefinedPixelTrait);
+ if (GetPixelChannelTraits(constImage(),channel) == UndefinedPixelTrait)
+ return(false);
+
+ if (channel == GreenPixelChannel || channel == BluePixelChannel)
+ return (GetPixelChannelOffset(constImage(),channel) == (ssize_t)channel);
+
+ return(true);
}
void Magick::Image::highlightColor(const Color color_)
diff --git a/Magick++/lib/Magick++/Include.h b/Magick++/lib/Magick++/Include.h
index 39a269f..2fd11fb 100644
--- a/Magick++/lib/Magick++/Include.h
+++ b/Magick++/lib/Magick++/Include.h
@@ -1270,6 +1270,7 @@
using MagickCore::GetNextValueInLinkedList;
using MagickCore::GetNumberOfElementsInLinkedList;
using MagickCore::GetPixelBlue;
+ using MagickCore::GetPixelChannelOffset;
using MagickCore::GetPixelChannelTraits;
using MagickCore::GetPixelGreen;
using MagickCore::GetPixelInfo;