code: def crop_black(img, tol=0):
      mask = (img > tol).all(2)
      mask0, mask1 = mask.any(0), mask.any(1)
      col_start, col_end = (
          mask0.argmax(),
          mask.shape[1] - mask0[::-1].argmax(),
      )
      row_start, row_end = (
          mask1.argmax(),
          mask.shape[0] - mask1[::-1].argmax(),
      )
      return img[row_start:row_end, col_start:col_end]
  
imports: import base64
  import json
  import warnings
  import numpy
  import zlib
  from PIL import Image, ImageDraw
  import torch
label_desc: Use image node_id 7 for calling a global function with example usage: crop_black(img, tol) and returns: img