JPEG-encode an image.
tf.io.encode_jpeg(
    image: Annotated[Any, _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
) -> Annotated[Any, _atypes.String]
Used in the notebooks
| Used in the tutorials | 
|---|
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. The- channelsdimension of- imagemust be 1.
- rgb: Output an RGB JPEG image. The- channelsdimension of- imagemust 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 Tensorof typestring. |