code: def test_png():
      """Simple noop encode/decode using png codec. Verify that supports uint16 png codec and monochrome and
      color images."""
      for size in [(300, 200), (300, 200, 3)]:
          for dtype in [np.uint8, np.uint16]:
              expected_image = np.random.randint(
                  0, np.iinfo(dtype).max, size=size, dtype=dtype
              )
              codec = CompressedImageCodec("png")
              field = UnischemaField(
                  name="field_image",
                  numpy_dtype=dtype,
                  shape=size,
                  codec=codec,
                  nullable=False,
              )
  
              actual_image = codec.decode(
                  field, codec.encode(field, expected_image)
              )
              np.testing.assert_array_equal(
                  expected_image, actual_image
              )
              assert expected_image.dtype == actual_image.dtype
  
file_path: petastorm/petastorm/tests/test_codec_compressed_image.py
imports: import io
  import numpy
  import pytest
  from PIL import Image
  from petastorm.codecs import CompressedImageCodec
  from petastorm.unischema import UnischemaField
label_desc: Use image node_id 1 for calling a global function with example usage: test_png() without return types