code: def prepare_image_inputs(
      feature_extract_tester,
      equal_resolution=False,
      numpify=False,
      torchify=False,
  ):
      """This function prepares a list of PIL images, or a list of numpy arrays if one specifies numpify=True,
      or a list of PyTorch tensors if one specifies torchify=True.
  
      One can specify whether the images are of the same resolution or not.
      """
  
      assert not (
          numpify and torchify
      ), "You cannot specify both numpy and PyTorch tensors at the same time"
  
      image_inputs = []
      for i in range(feature_extract_tester.batch_size):
          if equal_resolution:
              width = height = feature_extract_tester.max_resolution
          else:
              # To avoid getting image width/height 0
              min_resolution = feature_extract_tester.min_resolution
              if getattr(feature_extract_tester, "size_divisor", None):
                  # If `size_divisor` is defined, the image needs to have width/size >= `size_divisor`
                  min_resolution = max(
                      feature_extract_tester.size_divisor,
                      min_resolution,
                  )
              width, height = np.random.choice(
                  np.arange(
                      min_resolution,
                      feature_extract_tester.max_resolution,
                  ),
                  2,
              )
          image_inputs.append(
              np.random.randint(
                  255,
                  size=(
                      feature_extract_tester.num_channels,
                      width,
                      height,
                  ),
                  dtype=np.uint8,
              )
          )
  
      if not numpify and not torchify:
          # PIL expects the channel dimension as last dimension
          image_inputs = [
              Image.fromarray(np.moveaxis(image, 0, -1))
              for image in image_inputs
          ]
  
      if torchify:
          image_inputs = [
              torch.from_numpy(image) for image in image_inputs
          ]
  
      return image_inputs
  
imports: import json
  import os
  import sys
  import tempfile
  import unittest
  import unittest.mock
  from pathlib import Path
  from huggingface_hub import HfFolder, delete_repo, set_access_token
  from requests.exceptions import HTTPError
  from transformers import AutoFeatureExtractor, Wav2Vec2FeatureExtractor
  from transformers.testing_utils import TOKEN, USER, check_json_file_has_correct_format, get_tests_dir, is_staging_test
  from transformers.utils import is_torch_available, is_vision_available
  from test_module.custom_feature_extraction import CustomFeatureExtractor
label_desc: Use image node_id 1 for calling a global function with example usage: prepare_image_inputs(feature_extract_tester, equal_resolution, numpify, torchify) and returns: image_inputs