def save_resized_image(image_file, width_, height_, basewidth, aspect, height_size, upload_path, ext='jpg', remove_after_upload=False):
 filename = '{filename}.{ext}'.format(filename=time.time(), ext=ext)
 img = Image.open(image_file)
 if (aspect == 'on'):
  width_percent = (basewidth / float(img.size[0]))
  height_size = int((float(img.size[1]) * float(width_percent)))
 img = img.resize((basewidth, height_size), PIL.Image.ANTIALIAS)
 img.save(image_file)
 file = UploadedFile(file_path=image_file, filename=filename)
 if remove_after_upload:
  os.remove(image_file)
 return upload(file, upload_path)

def save_resized_image ( image_file , width_ , height_ , basewidth , aspect , height_size , upload_path , ext = 'jpg' , remove_after_upload = False ) : filename = '{filename}.{ext}' . format ( filename = time . time ( ) , ext = ext ) img = Image . open ( image_file ) if ( aspect == 'on' ) : width_percent = ( basewidth / float ( img . size [ 0 ] ) ) height_size = int ( ( float ( img . size [ 1 ] ) * float ( width_percent ) ) ) img = img . resize ( ( basewidth , height_size ) , PIL . Image . ANTIALIAS ) img . save ( image_file ) file = UploadedFile ( file_path = image_file , filename = filename ) if remove_after_upload : os . remove ( image_file ) return upload ( file , upload_path )
save the resized version of the background image .