Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
dòng chảy căng:: ôi:: Mã hóaPng
#include <image_ops.h>
PNG mã hóa một hình ảnh.
Bản tóm tắt
image
là Tensor 3-D uint8 hoặc uint16 có hình dạng [height, width, channels]
trong đó channels
là:
- 1: dành cho thang độ xám.
- 2: dành cho thang độ xám + alpha.
- 3: dành cho RGB.
- 4: cho RGBA.
Mức nén ZLIB, compression
, có thể là -1 đối với mặc định của bộ mã hóa PNG hoặc giá trị từ 0 đến 9. 9 là mức nén cao nhất, tạo ra đầu ra nhỏ nhất nhưng chậm hơn.
Lập luận:
- phạm vi: Một đối tượng Phạm vi
- hình ảnh: 3-D với hình dạng
[height, width, channels]
.
Thuộc tính tùy chọn (xem Attrs
):
Trả về:
-
Output
: 0-D. Hình ảnh được mã hóa PNG.
Thuộc tính công khai
Chức năng công cộng
nút
::tensorflow::Node * node() const
operator::tensorflow::Input() const
toán tử::tenorflow::Đầu ra
operator::tensorflow::Output() const
Các hàm tĩnh công khai
nén
Attrs Compression(
int64 x
)
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-26 UTC.
[null,null,["Cập nhật lần gần đây nhất: 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/r1.15/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/r1.15/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/r1.15/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/r1.15/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/r1.15/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r1.15/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/r1.15/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` image, const `[EncodePng::Attrs](/versions/r1.15/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/r1.15/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n| [operation](#classtensorflow_1_1ops_1_1_encode_png_1a3dd11638d8d7a6caa5c0151f099abff7) | [Operation](/versions/r1.15/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/r1.15/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/r1.15/api_docs/cc/struct/tensorflow/ops/encode-png/attrs) | Optional attribute setters for [EncodePng](/versions/r1.15/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```"]]