# tf.image.transpose

<br />

|---|---|
| [![](https://www.tensorflow.org/images/tf_logo_32px.png) TensorFlow 2 version](https://www.tensorflow.org/api_docs/python/tf/image/transpose) | [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/ops/image_ops_impl.py#L587-L614) |

Transpose image(s) by swapping the height and width dimension.

#### View aliases


**Main aliases**

\`tf.image.transpose_image\`
**Compat aliases for migration**

See
[Migration guide](https://www.tensorflow.org/guide/migrate) for
more details.

[`tf.compat.v1.image.transpose`](https://www.tensorflow.org/api_docs/python/tf/image/transpose), [`tf.compat.v1.image.transpose_image`](https://www.tensorflow.org/api_docs/python/tf/image/transpose), \`tf.compat.v2.image.transpose\`

<br />

    tf.image.transpose(
        image, name=None
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `image` | 4-D Tensor of shape `[batch, height, width, channels]` or 3-D Tensor of shape `[height, width, channels]`. |
| `name` | A name for this operation (optional). |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| If `image` was 4-D, a 4-D float Tensor of shape `[batch, width, height, channels]` If `image` was 3-D, a 3-D float Tensor of shape `[width, height, channels]` ||

<br />

<br />

<br />

<br />

| ## Raises ||
|---|---|
| `ValueError` | if the shape of `image` not supported. |

<br />