def negate(self, grayscale=False, channel=None):
        """Negate the colors in the reference image.

        :param grayscale: if set, only negate grayscale pixels in the image.
        :type grayscale: :class:`bool`
        :param channel: the channel type.  available values can be found
                        in the :const:`CHANNELS` mapping.  If ``None``,
                        negate all channels.
        :type channel: :class:`basestring`

        .. versionadded:: 0.3.8

        """
        if channel:
            try:
                ch_const = CHANNELS[channel]
            except __HOLE__:
                raise ValueError(repr(channel) + ' is an invalid channel type'
                                 '; see wand.image.CHANNELS dictionary')
            r = library.MagickNegateImageChannel(self.wand, ch_const,
                                                 grayscale)
        else:
            r = library.MagickNegateImage(self.wand, grayscale)
        if not r:
            self.raise_exception()
dataset/ETHPy150Open dahlia/wand/wand/image.py/BaseImage.negate