@cli.command('crop')
@click.option('-b', '--border', type=int, help='Crop the image from all sides by this amount.')
@processor
def crop_cmd(images, border):
 for image in images:
  box = [0, 0, image.size[0], image.size[1]]
  if (border is not None):
   for (idx, val) in enumerate(box):
    box[idx] = max(0, (val - border))
   click.echo(('Cropping "%s" by %dpx' % (image.filename, border)))
   (yield copy_filename(image.crop(box), image))
  else:
   (yield image)

@ cli . command ( 'crop' ) @ click . option ( '-b' , '--border' , type = int , help = 'Crop the image from all sides by this amount.' ) @ processor def crop_cmd ( images , border ) : for image in images : box = [ 0 , 0 , image . size [ 0 ] , image . size [ 1 ] ] if ( border is not None ) : for ( idx , val ) in enumerate ( box ) : box [ idx ] = max ( 0 , ( val - border ) ) click . echo ( ( 'Cropping "%s" by %dpx' % ( image . filename , border ) ) ) ( yield copy_filename ( image . crop ( box ) , image ) ) else : ( yield image )
crops an image from all edges .