@manipulative
    def quantize(self, number_colors, colorspace_type,
                 treedepth, dither, measure_error):
        if not isinstance(number_colors, numbers.Integral):
            raise TypeError('number_colors must be integral, '
                            'not ' + repr(number_colors))

        if not isinstance(colorspace_type, string_type) \
                or colorspace_type not in COLORSPACE_TYPES:
            raise TypeError('Colorspace value must be a string from '
                            'COLORSPACE_TYPES, not ' + repr(colorspace_type))

        if not isinstance(treedepth, numbers.Integral):
            raise TypeError('treedepth must be integral, '
                            'not ' + repr(treedepth))

        if not isinstance(dither, bool):
            raise TypeError('dither must be a bool, not ' +
                            repr(dither))

        if not isinstance(measure_error, bool):
            raise TypeError('measure_error must be a bool, not ' +
                            repr(measure_error))

        r = library.MagickQuantizeImage(
            self.wand, number_colors,
            COLORSPACE_TYPES.index(colorspace_type),
            treedepth, dither, measure_error
        )
        if not r:
            self.raise_exception()
`quantize` analyzes the colors within a sequence of images and
dataset/ETHPy150Open dahlia/wand/wand/image.py/BaseImage.quantize