Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
przepływ tensorowy:: ops:: KodujPng
#include <image_ops.h>
Zakoduj obraz w formacie PNG.
Streszczenie
image
jest trójwymiarowym tensorem uint8 lub uint16 o kształcie [height, width, channels]
gdzie channels
to:
- 1: dla skali szarości.
- 2: dla skali szarości + alfa.
- 3: dla RGB.
- 4: dla RGBA.
Poziom kompresji ZLIB, compression
, może wynosić -1 dla domyślnego kodera PNG lub wartość od 0 do 9. 9 to najwyższy poziom kompresji, generujący najmniejszy wynik, ale jest wolniejszy.
Argumenty:
- zakres: Obiekt Scope
- obraz: 3-D z kształtem
[height, width, channels]
.
Opcjonalne atrybuty (patrz Attrs
):
- kompresja: poziom kompresji.
Zwroty:
-
Output
: 0-D. Obraz zakodowany w formacie PNG.
Atrybuty publiczne
Funkcje publiczne
węzeł
::tensorflow::Node * node() const
operator::tensorflow::Input() const
operator::tensorflow::Wyjście
operator::tensorflow::Output() const
Publiczne funkcje statyczne
Kompresja
Attrs Compression(
int64 x
)
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-07-26 UTC.
[null,null,["Ostatnia aktualizacja: 2025-07-26 UTC."],[],[],null,["# tensorflow::ops::EncodePng Class Reference\n\ntensorflow::ops::EncodePng\n==========================\n\n`#include \u003cimage_ops.h\u003e`\n\nPNG-encode an image.\n\nSummary\n-------\n\n`image` is a 3-D uint8 or uint16 [Tensor](/versions/r2.2/api_docs/cc/class/tensorflow/tensor#classtensorflow_1_1_tensor) of shape `[height, width, channels]` where `channels` is:\n\n\n- 1: for grayscale.\n- 2: for grayscale + alpha.\n- 3: for RGB.\n- 4: for RGBA.\n\n\u003cbr /\u003e\n\nThe ZLIB compression level, `compression`, can be -1 for the PNG-encoder default or a value from 0 to 9. 9 is the highest compression level, generating the smallest output, but is slower.\n\nArguments:\n\n- scope: A [Scope](/versions/r2.2/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- image: 3-D with shape `[height, width, channels]`.\n\n\u003cbr /\u003e\n\nOptional attributes (see [Attrs](/versions/r2.2/api_docs/cc/struct/tensorflow/ops/encode-png/attrs#structtensorflow_1_1ops_1_1_encode_png_1_1_attrs)):\n\n- compression: Compression level.\n\n\u003cbr /\u003e\n\nReturns:\n\n- [Output](/versions/r2.2/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output): 0-D. PNG-encoded image.\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [EncodePng](#classtensorflow_1_1ops_1_1_encode_png_1a1dd56a89fbfdf0a35eb444d4342b2c7a)`(const ::`[tensorflow::Scope](/versions/r2.2/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.2/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` image)` ||\n| [EncodePng](#classtensorflow_1_1ops_1_1_encode_png_1a3f8275d8de85c565db8baef06d518dfa)`(const ::`[tensorflow::Scope](/versions/r2.2/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.2/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` image, const `[EncodePng::Attrs](/versions/r2.2/api_docs/cc/struct/tensorflow/ops/encode-png/attrs#structtensorflow_1_1ops_1_1_encode_png_1_1_attrs)` & attrs)` ||\n\n| ### Public attributes ||\n|----------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|\n| [contents](#classtensorflow_1_1ops_1_1_encode_png_1aac6f3548cb8e0539d4e65ddba93ac4b0) | `::`[tensorflow::Output](/versions/r2.2/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n| [operation](#classtensorflow_1_1ops_1_1_encode_png_1a3dd11638d8d7a6caa5c0151f099abff7) | [Operation](/versions/r2.2/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n\n| ### Public functions ||\n|----------------------------------------------------------------------------------------------------------------------|------------------------|\n| [node](#classtensorflow_1_1ops_1_1_encode_png_1a19512289f1f780298ec73b5fd6f54ce4)`() const ` | `::tensorflow::Node *` |\n| [operator::tensorflow::Input](#classtensorflow_1_1ops_1_1_encode_png_1aece039de4b9b0ff1b8b1462ceae15a1b)`() const ` | ` ` ` ` |\n| [operator::tensorflow::Output](#classtensorflow_1_1ops_1_1_encode_png_1ac1a34a63520602afd8ee1c203bc2ba30)`() const ` | ` ` ` ` |\n\n| ### Public static functions ||\n|-----------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------|\n| [Compression](#classtensorflow_1_1ops_1_1_encode_png_1ab763cfa8c279c172c2ee539abdad9338)`(int64 x)` | [Attrs](/versions/r2.2/api_docs/cc/struct/tensorflow/ops/encode-png/attrs#structtensorflow_1_1ops_1_1_encode_png_1_1_attrs) |\n\n| ### Structs ||\n|--------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------|\n| [tensorflow::ops::EncodePng::Attrs](/versions/r2.2/api_docs/cc/struct/tensorflow/ops/encode-png/attrs) | Optional attribute setters for [EncodePng](/versions/r2.2/api_docs/cc/class/tensorflow/ops/encode-png#classtensorflow_1_1ops_1_1_encode_png). |\n\nPublic attributes\n-----------------\n\n### contents\n\n```text\n::tensorflow::Output contents\n``` \n\n### operation\n\n```text\nOperation operation\n``` \n\nPublic functions\n----------------\n\n### EncodePng\n\n```gdscript\n EncodePng(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input image\n)\n``` \n\n### EncodePng\n\n```gdscript\n EncodePng(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input image,\n const EncodePng::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### Compression\n\n```text\nAttrs Compression(\n int64 x\n)\n```"]]