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/tutorials/imagenet_tutorial_localsearchattack.py
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  from past.utils import old_div
  import sys
  import logging
  import os
  import numpy
  import math
  import time
  import paddle.fluid
  from PIL import Image
  from adversarialbox.adversary import Adversary
  from adversarialbox.attacks.localsearch import LocalSearchAttack
  from image_classification.alexnet import AlexNet
  from adversarialbox.models.paddleBlackBox import PaddleBlackBoxModel
label_desc: Use image node_id 2 for calling a global function with example usage: crop_image(img, target_size, center) and returns: img