class_docstr: `FeatureConnector` for images.
  
  During `_generate_examples`, the feature connector accept as input any of:
  
    * `str`: path to a {bmp,gif,jpeg,png} image (ex: `/path/to/img.png`).
    * `np.array`: 3d `np.uint8` array representing an image.
    * A file object containing the png or jpeg encoded image string (ex:
      `io.BytesIO(encoded_img_bytes)`)
    * A `PIL.Image.Image`: PIL Image object.
  
  Output:
  
    `tf.Tensor` of type `tf.uint8` and shape `[height, width, num_channels]`
    for BMP, JPEG, and PNG images and shape `[num_frames, height, width, 3]` for
    GIF images.
  
  Example:
  
    * In the `tfds.core.DatasetInfo` object:
  
    ```python
    features=features.FeaturesDict({
        'input': features.Image(),
        'target': features.Image(shape=(None, None, 1), encoding_format='png'),
    })
    ```
  
    * During generation:
  
    ```python
    yield {
        'input': 'path/to/img.jpg',
        'target': np.ones(shape=(64, 64, 1), dtype=np.uint8),
    }
    ```
class_docstr_tok: ["`","FeatureConnector","`","for","images",".","During","`","_generate_examples","`",",","the","feature","connector","accept","as","input","any","of",":","*","`","str","`",":","path","to","a","{","bmp",",","gif",",","jpeg",",","png","}","image","(","ex",":","`","\/path\/to\/img.png","`",")",".","*","`","np.array","`",":","3d","`","np.uint8","`","array","representing","an","image",".","*","A","file","object","containing","the","png","or","jpeg","encoded","image","string","(","ex",":","`","io.BytesIO","(","encoded_img_bytes",")","`",")","*","A","`","PIL.Image.Image","`",":","PIL","Image","object",".","Output",":","`","tf.Tensor","`","of","type","`","tf.uint8","`","and","shape","`","[","height",",","width",",","num_channels","]","`","for","BMP",",","JPEG",",","and","PNG","images","and","shape","`","[","num_frames",",","height",",","width",",","3","]","`","for","GIF","images",".","Example",":","*","In","the","`","tfds.core.DatasetInfo","`","object",":","``","`","python","features=features.FeaturesDict","(","{","'input","'",":","features.Image","(",")",",","'target","'",":","features.Image","(","shape=","(","None",",","None",",","1",")",",","encoding_format='png","'",")",",","}",")","``","`","*","During","generation",":","``","`","python","yield","{","'input","'",":","'path\/to\/img.jpg","'",",","'target","'",":","np.ones","(","shape=","(","64",",","64",",","1",")",",","dtype=np.uint8",")",",","}","``","`"]
code: def to_json_content(self) -> feature_pb2.ImageFeature:
      return feature_pb2.ImageFeature(
          shape=feature_lib.to_shape_proto(self._shape),
          dtype=feature_lib.dtype_to_str(self._dtype),
          encoding_format=self._encoding_format,
          use_colormap=self._use_colormap,
      )
  
imports: from __future__ import annotations
  import dataclasses
  import functools
  import io
  import os
  import tempfile
  from typing import Any, List, Optional, Type, Union
  from absl import logging
  from etils import epath
  import numpy
  from tensorflow_datasets.core import lazy_imports_lib
  from tensorflow_datasets.core import utils
  from tensorflow_datasets.core.features import feature
  from tensorflow_datasets.core.proto import feature_pb2
  from tensorflow_datasets.core.utils import dtype_utils
  from tensorflow_datasets.core.utils import py_utils
  from tensorflow_datasets.core.utils import type_utils
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
label_desc: Use image node_id 14 for calling the Image obj's underlying member method code with example usage: obj.to_json_content() and returns: feature_pb2