# tensorflow::ops::DecodeAndCropJpeg Class Reference

# tensorflow::
ops::
DecodeAndCropJpeg

`
#include <image_ops.h>
`


Decode and Crop 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.


It is equivalent to a combination of decode and crop, but much faster by only decoding partial jpeg image.


Args:

- scope: A [Scope](https://www.tensorflow.org/versions/r2.6/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object
- contents: 0-D. The JPEG-encoded image.
- crop_window: 1-D. The crop window: \[crop_y, crop_x, crop_height, crop_width\].

<br />


Optional attributes (see
`
https://www.tensorflow.org/versions/r2.6/api_docs/cc/struct/tensorflow/ops/decode-and-crop-jpeg/attrs#structtensorflow_1_1ops_1_1_decode_and_crop_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.6/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.6/api_docs/cc/class/tensorflow/ops/decode-and-crop-jpeg#classtensorflow_1_1ops_1_1_decode_and_crop_jpeg_1a40f8322a3956b1982d0d78a7452613fc (const :: https://www.tensorflow.org/versions/r2.6/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope & scope, :: https://www.tensorflow.org/versions/r2.6/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input contents, :: https://www.tensorflow.org/versions/r2.6/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input crop_window) ` ||
| ` https://www.tensorflow.org/versions/r2.6/api_docs/cc/class/tensorflow/ops/decode-and-crop-jpeg#classtensorflow_1_1ops_1_1_decode_and_crop_jpeg_1a04b3586218bf0c15f49ea73f733b7aa9 (const :: https://www.tensorflow.org/versions/r2.6/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope & scope, :: https://www.tensorflow.org/versions/r2.6/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input contents, :: https://www.tensorflow.org/versions/r2.6/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input crop_window, const https://www.tensorflow.org/versions/r2.6/api_docs/cc/struct/tensorflow/ops/decode-and-crop-jpeg/attrs#structtensorflow_1_1ops_1_1_decode_and_crop_jpeg_1_1_attrs & attrs) ` ||

| ### Public attributes ||
|---|---|
| ` https://www.tensorflow.org/versions/r2.6/api_docs/cc/class/tensorflow/ops/decode-and-crop-jpeg#classtensorflow_1_1ops_1_1_decode_and_crop_jpeg_1ac86d4abf1b4381950b01a3d3b7b42033 ` | ` :: https://www.tensorflow.org/versions/r2.6/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output ` |
| ` https://www.tensorflow.org/versions/r2.6/api_docs/cc/class/tensorflow/ops/decode-and-crop-jpeg#classtensorflow_1_1ops_1_1_decode_and_crop_jpeg_1a7ca3572e2a7b2f2efbb2dfffca5d6bef ` | ` https://www.tensorflow.org/versions/r2.6/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation ` |

| ### Public functions ||
|---|---|
| ` https://www.tensorflow.org/versions/r2.6/api_docs/cc/class/tensorflow/ops/decode-and-crop-jpeg#classtensorflow_1_1ops_1_1_decode_and_crop_jpeg_1ab81a0fc51718ab73147ccc00f8a859fe () const ` | ` ::tensorflow::Node * ` |
| ` https://www.tensorflow.org/versions/r2.6/api_docs/cc/class/tensorflow/ops/decode-and-crop-jpeg#classtensorflow_1_1ops_1_1_decode_and_crop_jpeg_1a4bd46410ee7c7deb85a864042934ac25 () const ` | ` ` |
| ` https://www.tensorflow.org/versions/r2.6/api_docs/cc/class/tensorflow/ops/decode-and-crop-jpeg#classtensorflow_1_1ops_1_1_decode_and_crop_jpeg_1a6676c18a287c62f936e7bc369b687625 () const ` | ` ` |

| ### Public static functions ||
|---|---|
| ` https://www.tensorflow.org/versions/r2.6/api_docs/cc/class/tensorflow/ops/decode-and-crop-jpeg#classtensorflow_1_1ops_1_1_decode_and_crop_jpeg_1a03aa63bbe5a02cfb5735272956cfe14a (float x) ` | ` https://www.tensorflow.org/versions/r2.6/api_docs/cc/struct/tensorflow/ops/decode-and-crop-jpeg/attrs#structtensorflow_1_1ops_1_1_decode_and_crop_jpeg_1_1_attrs ` |
| ` https://www.tensorflow.org/versions/r2.6/api_docs/cc/class/tensorflow/ops/decode-and-crop-jpeg#classtensorflow_1_1ops_1_1_decode_and_crop_jpeg_1aafeb21d91856f8799a33028b25ed30f5 (int64 x) ` | ` https://www.tensorflow.org/versions/r2.6/api_docs/cc/struct/tensorflow/ops/decode-and-crop-jpeg/attrs#structtensorflow_1_1ops_1_1_decode_and_crop_jpeg_1_1_attrs ` |
| ` https://www.tensorflow.org/versions/r2.6/api_docs/cc/class/tensorflow/ops/decode-and-crop-jpeg#classtensorflow_1_1ops_1_1_decode_and_crop_jpeg_1a5aad56954952a3823b7446d5db735018 (StringPiece x) ` | ` https://www.tensorflow.org/versions/r2.6/api_docs/cc/struct/tensorflow/ops/decode-and-crop-jpeg/attrs#structtensorflow_1_1ops_1_1_decode_and_crop_jpeg_1_1_attrs ` |
| ` https://www.tensorflow.org/versions/r2.6/api_docs/cc/class/tensorflow/ops/decode-and-crop-jpeg#classtensorflow_1_1ops_1_1_decode_and_crop_jpeg_1ab270c3550997fa6825093eb3e76de49d (bool x) ` | ` https://www.tensorflow.org/versions/r2.6/api_docs/cc/struct/tensorflow/ops/decode-and-crop-jpeg/attrs#structtensorflow_1_1ops_1_1_decode_and_crop_jpeg_1_1_attrs ` |
| ` https://www.tensorflow.org/versions/r2.6/api_docs/cc/class/tensorflow/ops/decode-and-crop-jpeg#classtensorflow_1_1ops_1_1_decode_and_crop_jpeg_1ab5ff568c17de19ad85cd4e78585603ce (int64 x) ` | ` https://www.tensorflow.org/versions/r2.6/api_docs/cc/struct/tensorflow/ops/decode-and-crop-jpeg/attrs#structtensorflow_1_1ops_1_1_decode_and_crop_jpeg_1_1_attrs ` |
| ` https://www.tensorflow.org/versions/r2.6/api_docs/cc/class/tensorflow/ops/decode-and-crop-jpeg#classtensorflow_1_1ops_1_1_decode_and_crop_jpeg_1adb9221ee465f54e8ee30ea452d2bf2b9 (bool x) ` | ` https://www.tensorflow.org/versions/r2.6/api_docs/cc/struct/tensorflow/ops/decode-and-crop-jpeg/attrs#structtensorflow_1_1ops_1_1_decode_and_crop_jpeg_1_1_attrs ` |

| ### Structs ||
|---|---|
| [tensorflow:: ops:: DecodeAndCropJpeg:: Attrs](https://www.tensorflow.org/versions/r2.6/api_docs/cc/struct/tensorflow/ops/decode-and-crop-jpeg/attrs) | Optional attribute setters for [DecodeAndCropJpeg](https://www.tensorflow.org/versions/r2.6/api_docs/cc/class/tensorflow/ops/decode-and-crop-jpeg#classtensorflow_1_1ops_1_1_decode_and_crop_jpeg) . |

## Public attributes

### image

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

### operation

```
Operation operation
```

## Public functions

### DecodeAndCropJpeg

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

### DecodeAndCropJpeg

```
 DecodeAndCropJpeg(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input contents,
  ::tensorflow::Input crop_window,
  const DecodeAndCropJpeg::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
)
```