code: def crop_image(img, target_size, center):
      width, height = img.size
      size = target_size
      if center == True:
          w_start = old_div((width - size), 2)
          h_start = old_div((height - size), 2)
      else:
          w_start = random.randint(0, width - size)
          h_start = random.randint(0, height - size)
      w_end = w_start + size
      h_end = h_start + size
      img = img.crop((w_start, h_start, w_end, h_end))
      return img
  
file_path: AdvBox/example/reader.py
imports: from __future__ import division
  from past.utils import old_div
  import os
  import random
  import functools
  import numpy
  import paddle
  from PIL import Image, ImageEnhance
label_desc: Use image node_id 2 for calling a global function with example usage: crop_image(img, target_size, center) and returns: img