tensorflow::ops::EncodeJpeg
#include <image_ops.h>
JPEG-encode an image.
Summary
image
is a 3-D uint8 Tensor of shape [height, width, channels]
.
The attr format
can be used to override the color format of the encoded output. Values can be:
- `''
: Use a default format based on the number of channels in the image. *
grayscale: Output a grayscale JPEG image. The
channelsdimension of
imagemust be 1. *
rgb: Output an RGB JPEG image. The
channelsdimension of
image` must be 3.
If format
is not specified or is the empty string, a default format is picked in function of the number of channels in image
:
Arguments:
- scope: A Scope object
- image: 3-D with shape
[height, width, channels]
.
Optional attributes (see Attrs
):
- format: Per pixel image format.
- quality: Quality of the compression from 0 to 100 (higher is better and slower).
- progressive: If True, create a JPEG that loads progressively (coarse to fine).
- optimize_size: If True, spend CPU/RAM to reduce size with no quality change.
- chroma_downsampling: See http://en.wikipedia.org/wiki/Chroma_subsampling.
- density_unit: Unit used to specify
x_density
andy_density
: pixels per inch ('in'
) or centimeter ('cm'
). - x_density: Horizontal pixels per density unit.
- y_density: Vertical pixels per density unit.
- xmp_metadata: If not empty, embed this XMP metadata in the image header.
Returns:
-
Output
: 0-D. JPEG-encoded image.
Constructors and Destructors | |
---|---|
EncodeJpeg(const ::tensorflow::Scope & scope, ::tensorflow::Input image) | |
EncodeJpeg(const ::tensorflow::Scope & scope, ::tensorflow::Input image, const EncodeJpeg::Attrs & attrs) |
Public attributes | |
---|---|
contents | |
operation |
Public functions | |
---|---|
node() const | ::tensorflow::Node * |
operator::tensorflow::Input() const | |
operator::tensorflow::Output() const |
Public static functions | |
---|---|
ChromaDownsampling(bool x) | |
DensityUnit(StringPiece x) | |
Format(StringPiece x) | |
OptimizeSize(bool x) | |
Progressive(bool x) | |
Quality(int64 x) | |
XDensity(int64 x) | |
XmpMetadata(StringPiece x) | |
YDensity(int64 x) |
Structs | |
---|---|
tensorflow::ops::EncodeJpeg::Attrs | Optional attribute setters for EncodeJpeg. |
Public attributes
contents
::tensorflow::Output contents
operation
Operation operation
Public functions
EncodeJpeg
EncodeJpeg( const ::tensorflow::Scope & scope, ::tensorflow::Input image )
EncodeJpeg
EncodeJpeg( const ::tensorflow::Scope & scope, ::tensorflow::Input image, const EncodeJpeg::Attrs & attrs )
node
::tensorflow::Node * node() const
operator::tensorflow::Input
operator::tensorflow::Input() const
operator::tensorflow::Output
operator::tensorflow::Output() const
Public static functions
ChromaDownsampling
Attrs ChromaDownsampling( bool x )
DensityUnit
Attrs DensityUnit( StringPiece x )
Format
Attrs Format( StringPiece x )
OptimizeSize
Attrs OptimizeSize( bool x )
Progressive
Attrs Progressive( bool x )
Quality
Attrs Quality( int64 x )
XDensity
Attrs XDensity( int64 x )
XmpMetadata
Attrs XmpMetadata( StringPiece x )
YDensity
Attrs YDensity( int64 x )
© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r2.3/api_docs/cc/class/tensorflow/ops/encode-jpeg