JPEG-encode an image.
tf.io.encode_jpeg(
image: _atypes.TensorFuzzingAnnotation[_atypes.UInt8],
format: str = '',
quality: int = 95,
progressive: bool = False,
optimize_size: bool = False,
chroma_downsampling: bool = True,
density_unit: str = 'in',
x_density: int = 300,
y_density: int = 300,
xmp_metadata: str = '',
name=None
) -> _atypes.TensorFuzzingAnnotation[_atypes.String]
image
is a 3-D uint8 Tensor of shape [height, width, channels]
.
The attr format
can be used to override the color format of the encoded
output. Values can be:
''
: Use a default format based on the number of channels in the image.grayscale
: Output a grayscale JPEG image. Thechannels
dimension ofimage
must be 1.rgb
: Output an RGB JPEG image. Thechannels
dimension ofimage
must be 3.
If format
is not specified or is the empty string, a default format is picked
in function of the number of channels in image
:
- 1: Output a grayscale image.
- 3: Output an RGB image.
Returns | |
---|---|
A Tensor of type string .
|