<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/models/blob/v2.20.0/official/vision/ops/preprocess_ops.py#L177-L308) |

Resizes the input image to output size (RetinaNet style).

    tfm.vision.preprocess_ops.resize_and_crop_image(
        image,
        desired_size,
        padded_size,
        aug_scale_min=1.0,
        aug_scale_max=1.0,
        seed=1,
        method=tf.image.ResizeMethod.BILINEAR,
        keep_aspect_ratio=True,
        centered_crop=False
    )

Resize and pad images given the desired output size of the image and
stride size.

Here are the preprocessing steps.

1. For a given image, keep its aspect ratio and rescale the image to make it the largest rectangle to be bounded by the rectangle specified by the `desired_size`.
2. Pad the rescaled image to the padded_size.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `image` | a `Tensor` of shape \[height, width, c\] representing an image. |
| `desired_size` | a `Tensor` or `int` list/tuple of two elements representing \[height, width\] of the desired actual output image size. |
| `padded_size` | a `Tensor` or `int` list/tuple of two elements representing \[height, width\] of the padded output image size. Padding will be applied after scaling the image to the desired_size. Can be None to disable padding. |
| `aug_scale_min` | a `float` with range between \[0, 1.0\] representing minimum random scale applied to desired_size for training scale jittering. |
| `aug_scale_max` | a `float` with range between \[1.0, inf\] representing maximum random scale applied to desired_size for training scale jittering. |
| `seed` | seed for random scale jittering. |
| `method` | function to resize input image to scaled image. |
| `keep_aspect_ratio` | whether or not to keep the aspect ratio when resizing. |
| `centered_crop` | If `centered_crop` is set to True, then resized crop (if smaller than padded size) is place in the center of the image. Default behaviour is to place it at left top corner. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| `output_image` | `Tensor` of shape \[height, width, c\] where \[height, width\] equals to `output_size`. |
| `image_info` | a 2D `Tensor` that encodes the information of the image and the applied preprocessing. It is in the format of \[\[original_height, original_width\], \[desired_height, desired_width\], \[y_scale, x_scale\], \[y_offset, x_offset\]\], where \[desired_height, desired_width\] is the actual scaled image size, and \[y_scale, x_scale\] is the scaling factor, which is the ratio of scaled dimension / original dimension. |

<br />