# tensorflow::ops::DecodeJpeg Class Reference

# tensorflow::
ops::
DecodeJpeg

`
#include <image_ops.h>
`


Decode a JPEG-encoded image to a uint8 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 JPEG-encoded image.
- 1: output a grayscale image.
- 3: output an RGB image.

<br />


If needed, the JPEG-encoded image is transformed to match the requested number of color channels.


The attr
`
ratio
`
allows downscaling the image by an integer factor during decoding. Allowed values are: 1, 2, 4, and 8. This is much faster than downscaling the image later.


This op also supports decoding PNGs and non-animated GIFs since the interface is the same, though it is cleaner to use
`
tf.io.decode_image
`
.


Args:

- scope: A [Scope](https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object
- contents: 0-D. The JPEG-encoded image.

<br />


Optional attributes (see
`
https://www.tensorflow.org/versions/r2.5/api_docs/cc/struct/tensorflow/ops/decode-jpeg/attrs#structtensorflow_1_1ops_1_1_decode_jpeg_1_1_attrs
`
):

- channels: Number of color channels for the decoded image.
- ratio: Downscaling ratio.
- fancy_upscaling: If true use a slower but nicer upscaling of the chroma planes (yuv420/422 only).
- try_recover_truncated: If true try to recover an image from truncated input.
- acceptable_fraction: The minimum required fraction of lines before a truncated input is accepted.
- dct_method: string specifying a hint about the algorithm used for decompression. Defaults to "" which maps to a system-specific default. Currently valid values are \["INTEGER_FAST", "INTEGER_ACCURATE"\]. The hint may be ignored (e.g., the internal jpeg library changes to a version that does not have that specific option.)

<br />


Returns:

- `
  https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output
  ` : 3-D with shape `
  [height, width, channels]
  ` ..

<br />

| ### Constructors and Destructors ||
|---|---|
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/decode-jpeg#classtensorflow_1_1ops_1_1_decode_jpeg_1ac4de6e02218f7ad73fca207fdedcbcad (const :: https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope & scope, :: https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input contents) ` ||
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/decode-jpeg#classtensorflow_1_1ops_1_1_decode_jpeg_1a3d8ca9fbb0c56f07d1dfc15707345456 (const :: https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope & scope, :: https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input contents, const https://www.tensorflow.org/versions/r2.5/api_docs/cc/struct/tensorflow/ops/decode-jpeg/attrs#structtensorflow_1_1ops_1_1_decode_jpeg_1_1_attrs & attrs) ` ||

| ### Public attributes ||
|---|---|
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/decode-jpeg#classtensorflow_1_1ops_1_1_decode_jpeg_1ae6c2f8ba16e122ec6fffd95b36d65ead ` | ` :: https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output ` |
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/decode-jpeg#classtensorflow_1_1ops_1_1_decode_jpeg_1ac493d7d06da539cac7983b2046f8e9d1 ` | ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation ` |

| ### Public functions ||
|---|---|
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/decode-jpeg#classtensorflow_1_1ops_1_1_decode_jpeg_1a62de1d307840ceb881b006cd346264f1 () const ` | ` ::tensorflow::Node * ` |
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/decode-jpeg#classtensorflow_1_1ops_1_1_decode_jpeg_1a87002e2b5765be434ab912f4ae691605 () const ` | ` ` |
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/decode-jpeg#classtensorflow_1_1ops_1_1_decode_jpeg_1af3a81e6979e68a832cbbc27890b24704 () const ` | ` ` |

| ### Public static functions ||
|---|---|
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/decode-jpeg#classtensorflow_1_1ops_1_1_decode_jpeg_1a3e5bf8acaa171c786f414da0c3717e15 (float x) ` | ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/struct/tensorflow/ops/decode-jpeg/attrs#structtensorflow_1_1ops_1_1_decode_jpeg_1_1_attrs ` |
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/decode-jpeg#classtensorflow_1_1ops_1_1_decode_jpeg_1a4ced6488b8eb52569e4c64cb514ae5af (int64 x) ` | ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/struct/tensorflow/ops/decode-jpeg/attrs#structtensorflow_1_1ops_1_1_decode_jpeg_1_1_attrs ` |
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/decode-jpeg#classtensorflow_1_1ops_1_1_decode_jpeg_1a11a129bf8cb32c9b4b80b8f379be1356 (StringPiece x) ` | ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/struct/tensorflow/ops/decode-jpeg/attrs#structtensorflow_1_1ops_1_1_decode_jpeg_1_1_attrs ` |
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/decode-jpeg#classtensorflow_1_1ops_1_1_decode_jpeg_1a32505c9ff48d85625d2d574385e580d7 (bool x) ` | ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/struct/tensorflow/ops/decode-jpeg/attrs#structtensorflow_1_1ops_1_1_decode_jpeg_1_1_attrs ` |
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/decode-jpeg#classtensorflow_1_1ops_1_1_decode_jpeg_1a55a5fb907878bbe1ed6fc08e696f55ce (int64 x) ` | ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/struct/tensorflow/ops/decode-jpeg/attrs#structtensorflow_1_1ops_1_1_decode_jpeg_1_1_attrs ` |
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/decode-jpeg#classtensorflow_1_1ops_1_1_decode_jpeg_1a0d8254ea2a648d8ad63b90b2e39d9cf5 (bool x) ` | ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/struct/tensorflow/ops/decode-jpeg/attrs#structtensorflow_1_1ops_1_1_decode_jpeg_1_1_attrs ` |

| ### Structs ||
|---|---|
| [tensorflow:: ops:: DecodeJpeg:: Attrs](https://www.tensorflow.org/versions/r2.5/api_docs/cc/struct/tensorflow/ops/decode-jpeg/attrs) | Optional attribute setters for [DecodeJpeg](https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/decode-jpeg#classtensorflow_1_1ops_1_1_decode_jpeg) . |

## Public attributes

### image

```
::tensorflow::Output image
```

### operation

```
Operation operation
```

## Public functions

### DecodeJpeg

```
 DecodeJpeg(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input contents
)
```

### DecodeJpeg

```
 DecodeJpeg(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input contents,
  const DecodeJpeg::Attrs & attrs
)
```

### node

```
::tensorflow::Node * node() const 
```

### operator::tensorflow::Input

```
 operator::tensorflow::Input() const 
```

### operator::tensorflow::Output

```
 operator::tensorflow::Output() const 
```

## Public static functions

### AcceptableFraction

```
Attrs AcceptableFraction(
  float x
)
```

### Channels

```
Attrs Channels(
  int64 x
)
```

### DctMethod

```
Attrs DctMethod(
  StringPiece x
)
```

### FancyUpscaling

```
Attrs FancyUpscaling(
  bool x
)
```

### Ratio

```
Attrs Ratio(
  int64 x
)
```

### TryRecoverTruncated

```
Attrs TryRecoverTruncated(
  bool x
)
```