def resize(self, width, height, **kwargs):
        """Resizes the image to the supplied width/height. Returns the
        instance. Supports the following optional keyword arguments:

        mode - The resizing mode to use, see Image.MODES
        filter - The filter to use: see Image.FILTERS
        background - The hexadecimal background fill color, RGB or ARGB
        position - The position used to crop: see Image.POSITIONS for
                   pre-defined positions or a custom position ratio
        retain - The minimum percentage of the original image to retain
                 when cropping
        """
        opts = Image._normalize_options(kwargs)
        size = self._get_size(width, height)
        if opts["mode"] == "adapt":
            self._adapt(size, opts)
        elif opts["mode"] == "clip":
            self._clip(size, opts)
        elif opts["mode"] == "fill":
            self._fill(size, opts)
        elif opts["mode"] == "scale":
            self._scale(size, opts)
        else:
            self._crop(size, opts)
        return self
def resize ( self , width , height , ** kwargs ) : opts = Image . _normalize_options ( kwargs ) size = self . _get_size ( width , height ) if opts [ "mode" ] == "adapt" : self . _adapt ( size , opts ) elif opts [ "mode" ] == "clip" : self . _clip ( size , opts ) elif opts [ "mode" ] == "fill" : self . _fill ( size , opts ) elif opts [ "mode" ] == "scale" : self . _scale ( size , opts ) else : self . _crop ( size , opts ) return self
Resizes the image to the supplied width/height. Returns the
        instance. Supports the following optional keyword arguments:

        mode - The resizing mode to use, see Image.MODES
        filter - The filter to use: see Image.FILTERS
        background - The hexadecimal background fill color, RGB or ARGB
        position - The position used to crop: see Image.POSITIONS for
                   pre-defined positions or a custom position ratio
        retain - The minimum percentage of the original image to retain
                 when cropping