code: def croptobbox(img, border=None):
      """
      nimg = croptobbox(img, border=0)
  
      Returns a version of img cropped to the image's bounding box
  
      Parameters
      ----------
      img : ndarray
          Integer image array
      border : int, optional
          whether to add a border (default no border)
  
      Returns
      -------
      nimg : ndarray
          A subimage of img.
  
      Notes
      -----
      Note that the border is on the bounding box, not on the final
      image! This means that if the image has a positive pixel on its margin,
      it will still be on the margin.
  
      This ensures that the result is always a sub-image of the input.
      """
      sl = bbox(img, border=border, as_slice=True)
      return img[sl]
  
imports: from __future__ import division
  from .None import _bbox
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: croptobbox(img, border) and returns: img