Stay organized with collections
Save and categorize content based on your preferences.
tensorflow::ops::DecodePng
#include <image_ops.h>
Decode a PNG-encoded image to a uint8 or uint16 tensor.
Summary
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 PNG-encoded image.
- 1: output a grayscale image.
- 3: output an RGB image.
- 4: output an RGBA image.
If needed, the PNG-encoded image is transformed to match the requested number of color channels.
This op also supports decoding JPEGs and non-animated GIFs since the interface is the same, though it is cleaner to use tf.io.decode_image
.
Args:
- scope: A Scope object
- contents: 0-D. The PNG-encoded image.
Optional attributes (see Attrs
):
- channels: Number of color channels for the decoded image.
Returns:
Output
: 3-D with shape [height, width, channels]
.
Public attributes
Public functions
node
::tensorflow::Node * node() const
operator::tensorflow::Input() const
operator::tensorflow::Output
operator::tensorflow::Output() const
Public static functions
Channels
Attrs Channels(
int64 x
)
Dtype
Attrs Dtype(
DataType x
)
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2023-10-06 UTC.
[null,null,["Last updated 2023-10-06 UTC."],[],[],null,["# tensorflow::ops::DecodePng Class Reference\n\ntensorflow::ops::DecodePng\n==========================\n\n`#include \u003cimage_ops.h\u003e`\n\nDecode a PNG-encoded image to a uint8 or uint16 tensor.\n\nSummary\n-------\n\nThe attr `channels` indicates the desired number of color channels for the decoded image.\n\nAccepted values are:\n\n\n- 0: Use the number of channels in the PNG-encoded image.\n- 1: output a grayscale image.\n- 3: output an RGB image.\n- 4: output an RGBA image.\n\n\u003cbr /\u003e\n\nIf needed, the PNG-encoded image is transformed to match the requested number of color channels.\n\nThis op also supports decoding JPEGs and non-animated GIFs since the interface is the same, though it is cleaner to use `tf.io.decode_image`.\n\nArgs:\n\n- scope: A [Scope](/versions/r2.14/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- contents: 0-D. The PNG-encoded image.\n\n\u003cbr /\u003e\n\nOptional attributes (see [Attrs](/versions/r2.14/api_docs/cc/struct/tensorflow/ops/decode-png/attrs#structtensorflow_1_1ops_1_1_decode_png_1_1_attrs)):\n\n- channels: Number of color channels for the decoded image.\n\n\u003cbr /\u003e\n\nReturns:\n\n- [Output](/versions/r2.14/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output): 3-D with shape `[height, width, channels]`.\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [DecodePng](#classtensorflow_1_1ops_1_1_decode_png_1ab7adeeb5aa6b10893fb6063ee8d6fc87)`(const ::`[tensorflow::Scope](/versions/r2.14/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.14/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` contents)` ||\n| [DecodePng](#classtensorflow_1_1ops_1_1_decode_png_1aa2df55e8e1eed056df69f127ca4cba25)`(const ::`[tensorflow::Scope](/versions/r2.14/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.14/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` contents, const `[DecodePng::Attrs](/versions/r2.14/api_docs/cc/struct/tensorflow/ops/decode-png/attrs#structtensorflow_1_1ops_1_1_decode_png_1_1_attrs)` & attrs)` ||\n\n| ### Public attributes ||\n|----------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|\n| [image](#classtensorflow_1_1ops_1_1_decode_png_1a493e0f58c502e83895b5ab8df3ed277c) | `::`[tensorflow::Output](/versions/r2.14/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n| [operation](#classtensorflow_1_1ops_1_1_decode_png_1ac11da6e89a194ee86e7a82442fb33ed4) | [Operation](/versions/r2.14/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n\n| ### Public functions ||\n|----------------------------------------------------------------------------------------------------------------------|------------------------|\n| [node](#classtensorflow_1_1ops_1_1_decode_png_1adea6247b44969accb1513a6b237bd2d3)`() const ` | `::tensorflow::Node *` |\n| [operator::tensorflow::Input](#classtensorflow_1_1ops_1_1_decode_png_1a1449fe5081528b4cb081cb224ba20d96)`() const ` | |\n| [operator::tensorflow::Output](#classtensorflow_1_1ops_1_1_decode_png_1a19025343d7746c9091afcf01dbba03fd)`() const ` | |\n\n| ### Public static functions ||\n|--------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------|\n| [Channels](#classtensorflow_1_1ops_1_1_decode_png_1ac0322c095dfd2d11bca81c46b421847a)`(int64 x)` | [Attrs](/versions/r2.14/api_docs/cc/struct/tensorflow/ops/decode-png/attrs#structtensorflow_1_1ops_1_1_decode_png_1_1_attrs) |\n| [Dtype](#classtensorflow_1_1ops_1_1_decode_png_1a656dedb17c75247c916d54efef9fb4f6)`(DataType x)` | [Attrs](/versions/r2.14/api_docs/cc/struct/tensorflow/ops/decode-png/attrs#structtensorflow_1_1ops_1_1_decode_png_1_1_attrs) |\n\n| ### Structs ||\n|---------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------|\n| [tensorflow::ops::DecodePng::Attrs](/versions/r2.14/api_docs/cc/struct/tensorflow/ops/decode-png/attrs) | Optional attribute setters for [DecodePng](/versions/r2.14/api_docs/cc/class/tensorflow/ops/decode-png#classtensorflow_1_1ops_1_1_decode_png). |\n\nPublic attributes\n-----------------\n\n### image\n\n```text\n::tensorflow::Output image\n``` \n\n### operation\n\n```text\nOperation operation\n``` \n\nPublic functions\n----------------\n\n### DecodePng\n\n```gdscript\n DecodePng(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input contents\n)\n``` \n\n### DecodePng\n\n```gdscript\n DecodePng(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input contents,\n const DecodePng::Attrs & attrs\n)\n``` \n\n### node\n\n```gdscript\n::tensorflow::Node * node() const \n``` \n\n### operator::tensorflow::Input\n\n```gdscript\n operator::tensorflow::Input() const \n``` \n\n### operator::tensorflow::Output\n\n```gdscript\n operator::tensorflow::Output() const \n``` \n\nPublic static functions\n-----------------------\n\n### Channels\n\n```text\nAttrs Channels(\n int64 x\n)\n``` \n\n### Dtype\n\n```carbon\nAttrs Dtype(\n DataType x\n)\n```"]]