def pil_resize(maxwidth, path_in, path_out=None):
 path_out = (path_out or temp_file_for(path_in))
 from PIL import Image
 log.debug(u'artresizer: PIL resizing {0} to {1}', util.displayable_path(path_in), util.displayable_path(path_out))
 try:
  im = Image.open(util.syspath(path_in))
  size = (maxwidth, maxwidth)
  im.thumbnail(size, Image.ANTIALIAS)
  im.save(path_out)
  return path_out
 except IOError:
  log.error(u"PIL cannot create thumbnail for '{0}'", util.displayable_path(path_in))
  return path_in

def pil_resize ( maxwidth , path_in , path_out = None ) : path_out = ( path_out or temp_file_for ( path_in ) ) from PIL import Image log . debug ( u'artresizer: PIL resizing {0} to {1}' , util . displayable_path ( path_in ) , util . displayable_path ( path_out ) ) try : im = Image . open ( util . syspath ( path_in ) ) size = ( maxwidth , maxwidth ) im . thumbnail ( size , Image . ANTIALIAS ) im . save ( path_out ) return path_out except IOError : log . error ( u"PIL cannot create thumbnail for '{0}'" , util . displayable_path ( path_in ) ) return path_in
resize using python imaging library .