<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/keras-team/keras/tree/v3.15.1/keras/src/ops/image.py#L1484-L1548) |

Crop `images` to a specified `height` and `width`.

    tf.keras.ops.image.crop_images(
        images,
        top_cropping=None,
        left_cropping=None,
        bottom_cropping=None,
        right_cropping=None,
        target_height=None,
        target_width=None,
        data_format=None
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `images` | Input image or batch of images. Must be 3D or 4D. |
| `top_cropping` | Number of columns to crop from the top. |
| `left_cropping` | Number of columns to crop from the left. |
| `bottom_cropping` | Number of columns to crop from the bottom. |
| `right_cropping` | Number of columns to crop from the right. |
| `target_height` | Height of the output images. |
| `target_width` | Width of the output images. |
| `data_format` | A string specifying the data format of the input tensor. It can be either `"channels_last"` or `"channels_first"`. `"channels_last"` corresponds to inputs with shape `(batch, height, width, channels)`, while `"channels_first"` corresponds to inputs with shape `(batch, channels, height, width)`. If not specified, the value will default to [`keras.config.image_data_format`](https://www.tensorflow.org/api_docs/python/tf/keras/backend/image_data_format). |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| Cropped image or batch of images. ||

<br />

#### Example:

    images = np.reshape(np.arange(1, 28, dtype="float32"), [3, 3, 3])
    images[:,:,0] # print the first channel of the images
    array([[ 1.,  4.,  7.],
           [10., 13., 16.],
           [19., 22., 25.]], dtype=float32)
    cropped_images = keras.image.crop_images(images, 0, 0, 2, 2)
    cropped_images[:,:,0] # print the first channel of the cropped images
    array([[ 1.,  4.],
           [10., 13.]], dtype=float32)