def get_rendition_size(self, spec, output_scale, crop):
        """
        Wrapper to determine the overall rendition size and cropping box

        Returns tuple of (size,box)
        """

        if crop:
            # Use the cropping rectangle size
            _, _, width, height = crop
        else:
            # Use the original image size
            width = self._record.width
            height = self._record.height

        mode = spec.get('resize', 'fit')
        if mode == 'fit':
            return self.get_rendition_fit_size(spec, width, height, output_scale)

        if mode == 'fill':
            return self.get_rendition_fill_size(spec, width, height, output_scale)

        if mode == 'stretch':
            return self.get_rendition_stretch_size(spec, width, height, output_scale)

        raise ValueError("Unknown resize mode {}".format(mode))
def get_rendition_size ( self , spec , output_scale , crop ) : if crop : _ , _ , width , height = crop else : width = self . _record . width height = self . _record . height mode = spec . get ( 'resize' , 'fit' ) if mode == 'fit' : return self . get_rendition_fit_size ( spec , width , height , output_scale ) if mode == 'fill' : return self . get_rendition_fill_size ( spec , width , height , output_scale ) if mode == 'stretch' : return self . get_rendition_stretch_size ( spec , width , height , output_scale ) raise ValueError ( "Unknown resize mode {}" . format ( mode ) )
Wrapper to determine the overall rendition size and cropping box

        Returns tuple of (size,box)