<s> try : <EOL> from PIL import Image <EOL> except ImportError : <EOL> import Image <EOL> def makeThumb ( image , maxSize , method = <NUM_LIT:3> ) : <EOL> '<STR_LIT>' <EOL> orig_size = image . size <EOL> if orig_size [ <NUM_LIT:0> ] > maxSize [ <NUM_LIT:0> ] or orig_size [ <NUM_LIT:1> ] > maxSize [ <NUM_LIT:1> ] : <EOL> min_extent = min ( orig_size [ <NUM_LIT:0> ] , orig_size [ <NUM_LIT:1> ] ) <EOL> left = ( orig_size [ <NUM_LIT:0> ] - min_extent ) / <NUM_LIT:2> <EOL> top = ( orig_size [ <NUM_LIT:1> ] - min_extent ) / <NUM_LIT:2> <EOL> result = image . crop ( ( left , top , left + min_extent , top + min_extent ) ) <EOL> result = result . resize ( maxSize , Image . ANTIALIAS ) <EOL> return ( result , maxSize ) <EOL> else : <EOL> return ( image , orig_size ) </s>
