Adjust jpeg encoding quality of an image.
View aliases
Compat aliases for migration
See Migration guide for more details.
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]
.
Args | |
---|---|
image
|
3D image. 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). |
Returns | |
---|---|
Adjusted image, same shape and DType as image .
|
Usage Example:
>> import tensorflow as tf
>> x = tf.random.normal(shape=(256, 256, 3))
>> tf.image.adjust_jpeg_quality(x, 75)
Raises | |
---|---|
InvalidArgumentError
|
quality must be in [0,100] |
InvalidArgumentError
|
image must have 1 or 3 channels |