Decode a WebP-encoded image to a uint8 tensor.
tf.io.decode_webp(
contents: Annotated[Any, _atypes.String],
channels: int = 0,
dtype: TV_DecodeWebP_dtype = tf.dtypes.uint8,
name=None
) -> Annotated[Any, TV_DecodeWebP_dtype]
The attr channels indicates the desired number of color channels for the
decoded image.
Accepted values are:
- 0: Use the number of channels in the WebP-encoded image.
- 3: output an RGB image.
- 4: output an RGBA image.
The number of channels must currently match that of the underlying file. For WebP animations, only 4-channel RGBA is supported.
Args | |
|---|---|
contents
|
A Tensor of type string. 0-D. The WebP-encoded image.
|
channels
|
An optional int. Defaults to 0.
Number of color channels for the decoded image.
|
dtype
|
An optional tf.DType from: tf.uint8. Defaults to tf.uint8.
|
name
|
A name for the operation (optional). |
Returns | |
|---|---|
A Tensor of type dtype.
|