# tf.image.adjust_jpeg_quality

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.7.4/tensorflow/python/ops/image_ops_impl.py#L2833-L2881) |

Adjust jpeg encoding quality of an image.

#### View aliases


**Compat aliases for migration**

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

[`tf.compat.v1.image.adjust_jpeg_quality`](https://www.tensorflow.org/api_docs/python/tf/image/adjust_jpeg_quality)

<br />

    tf.image.adjust_jpeg_quality(
        image, jpeg_quality, name=None
    )

This is a convenience method that converts an image to uint8 representation,
encodes it to jpeg with `jpeg_quality`, decodes it, and then converts back
to the original data type.

`jpeg_quality` must be in the interval `[0, 100]`.

#### Usage Example:

    x = [[[1.0, 2.0, 3.0],
          [4.0, 5.0, 6.0]],
        [[7.0, 8.0, 9.0],
          [10.0, 11.0, 12.0]]]
    tf.image.adjust_jpeg_quality(x, 75)
    <tf.Tensor: shape=(2, 2, 3), dtype=float32, numpy=
    array([[[1., 1., 1.],
            [1., 1., 1.]],
           [[1., 1., 1.],
            [1., 1., 1.]]], dtype=float32)>

<br />

<br />

<br />

| ## Args ||
|---|---|
| `image` | 3D image. The size of the last dimension must be None, 1 or 3. |
| `jpeg_quality` | Python int or Tensor of type int32. jpeg encoding quality. |
| `name` | A name for this operation (optional). |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| Adjusted image, same shape and DType as `image`. ||

<br />

<br />

<br />

<br />

| ## Raises ||
|---|---|
| `InvalidArgumentError` | quality must be in \[0,100\] |
| `InvalidArgumentError` | image must have 1 or 3 channels |

<br />