tf.io.decode_jpeg

Decode a JPEG-encoded image to a uint8 tensor.

tf.io.decode_jpeg(
    contents, channels=0, ratio=1, fancy_upscaling=True,
    try_recover_truncated=False, acceptable_fraction=1, dct_method='', name=None
)

The attr channels indicates the desired number of color channels for the decoded image.

Accepted values are:

If needed, the JPEG-encoded image is transformed to match the requested number of color channels.

The attr ratio allows downscaling the image by an integer factor during decoding. Allowed values are: 1, 2, 4, and 8. This is much faster than downscaling the image later.

This op also supports decoding PNGs and non-animated GIFs since the interface is the same, though it is cleaner to use tf.image.decode_image.

Args:

Returns:

A Tensor of type uint8.