code: def _decode_and_center_crop(image_bytes):
      """Crops to center of image with padding then scales image size."""
      shape = tf.image.extract_jpeg_shape(image_bytes)
      image_height = shape[0]
      image_width = shape[1]
  
      padded_center_crop_size = tf.cast(
          (
              (_IMAGE_SIZE / (_IMAGE_SIZE + _CROP_PADDING))
              * tf.cast(
                  tf.minimum(image_height, image_width), tf.float32
              )
          ),
          tf.int32,
      )
  
      offset_height = (
          (image_height - padded_center_crop_size) + 1
      ) // 2
      offset_width = ((image_width - padded_center_crop_size) + 1) // 2
      crop_window = tf.stack(
          [
              offset_height,
              offset_width,
              padded_center_crop_size,
              padded_center_crop_size,
          ]
      )
      image = tf.image.decode_and_crop_jpeg(
          image_bytes, crop_window, channels=3
      )
      image = tf.image.resize(
          [image],
          [_IMAGE_SIZE, _IMAGE_SIZE],
          method=tf.image.ResizeMethod.BICUBIC,
      )[0]
      image = tf.cast(image, tf.int32)
  
      return image
  
file_path: datasets/tensorflow_datasets/datasets/imagenet2012_corrupted/imagenet2012_corrupted_dataset_builder.py
imports: from absl import logging
  import numpy
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
  from tensorflow_datasets.datasets.imagenet2012 import imagenet2012_dataset_builder
  from tensorflow_datasets.datasets.imagenet2012 import imagenet_common
  from tensorflow_datasets.image_classification import corruptions
  import tensorflow_datasets.public_api
label_desc: Use image node_id 2 for calling a global function with example usage: _decode_and_center_crop(image_bytes) and returns: image