(image, size)
return image.crop(box)
Cuts out a minature from the cropped background image
Cuts out a minature from the cropped background image
Cuts out a minature from the cropped background image
def crop_thumbnail(image, size):
    """ Cuts out a minature from the cropped background image """
    max_w, max_h = size
    width, height = image.getdata().size
    new_width = int(width * float(max_h)/float(height))
    startx = int((new_width - max_w) / 2)
    image = image.resize((new_width, max_h), Image.ANTIALIAS)
    box = (startx, 0, startx + max_w, max_h)
    return image.crop(box)
def crop_thumbnail ( image , size ) : max_w , max_h = size width , height = image . getdata ( ) . size new_width = int ( width * float ( max_h ) / float ( height ) ) startx = int ( ( new_width - max_w ) / 2 ) image = image . resize ( ( new_width , max_h ) , Image . ANTIALIAS ) box = ( startx , 0 , startx + max_w , max_h ) return image . crop ( box )