def set_filter_type(self, filter_type=None):
        """
        Set(modify) filtering mode for better compression

        `filter_type` is number or name of filter type for better compression
        see http://www.w3.org/TR/PNG/#9Filter-types for details
        It's also possible to use adaptive strategy for choosing filter type
        per row. Predefined strategies are `sum` and `entropy`.
        Custom strategies can be added with :meth:`register_extra_filter` or
        be callable passed with this argument.
        (see more at :meth:`register_extra_filter`)
        """
        if filter_type is None:
            filter_type = 0
        elif isinstance(filter_type, basestring):
            str_ftype = str(filter_type).lower()
            filter_names = {'none': 0,
                            'sub': 1,
                            'up': 2,
                            'average': 3,
                            'paeth': 4}
            if str_ftype in filter_names:
                filter_type = filter_names[str_ftype]
        self.filter_type = filter_type
Set(modify) filtering mode for better compression

        `filter_type` is number or name of filter type for better compression
        see http://www.w3.org/TR/PNG/#9Filter-types for details
        It's also possible to use adaptive strategy for choosing filter type
        per row. Predefined strategies are `sum` and `entropy`.
        Custom strategies can be added with :meth:`register_extra_filter` or
        be callable passed with this argument.
        (see more at :meth:`register_extra_filter`)