code: def _read_stream(
      self, f: "pyarrow.NativeFile", path: str
  ) -> Iterator[Block]:
      import io
      import numpy as np
      from PIL import Image
      from ray.data._internal.delegating_block_builder import (
          DelegatingBlockBuilder,
      )
  
      data = f.readall()
      image = Image.open(io.BytesIO(data))
      image = image.convert(self.mode)
  
      # Each block contains one row
      builder = DelegatingBlockBuilder()
      array = np.array(image)
      item = {"image": array}
      builder.add(item)
      yield builder.build()
  
file_path: ray/doc/source/data/doc_code/custom_datasource_example.py
imports: from typing import Iterator, Union, List
  import pyarrow
  from ray.data.block import Block
  from ray.data.datasource import FileBasedDatasource
  import ray
  from typing import Any, Dict
  import pyarrow
  from ray.data.datasource import RowBasedFileDatasink
label_desc: Use image node_id 2 for calling the ImageDatasource obj's underlying member method code with example usage: obj._read_stream(f, path) without return types