code: def test_png(setup_library, test_images, tmp_path):
      fnamebase = str(tmp_path / "test")
  
      for isfloat in (False, True):
          for crop in (0, 1, 2):
              for colors in (0, 1, 3, 4):
                  fname = fnamebase + "%i.%i.%i.png" % (
                      isfloat,
                      crop,
                      colors,
                  )
                  rim = get_ref_im(colors, crop, isfloat)
                  iio.imsave(fname, rim)
                  im = iio.imread(fname)
                  mul = 255 if isfloat else 1
                  assert_close(rim * mul, im, 0.1)  # lossless
  
      # Run exact same test, but now in pypy backup mode
      try:
          imageio.plugins._freeimage.TEST_NUMPY_NO_STRIDES = True
          for isfloat in (False, True):
              for crop in (0, 1, 2):
                  for colors in (0, 1, 3, 4):
                      fname = fnamebase + "%i.%i.%i.png" % (
                          isfloat,
                          crop,
                          colors,
                      )
                      rim = get_ref_im(colors, crop, isfloat)
                      iio.imsave(fname, rim)
                      im = iio.imread(fname)
                      mul = 255 if isfloat else 1
                      assert_close(rim * mul, im, 0.1)  # lossless
      finally:
          imageio.plugins._freeimage.TEST_NUMPY_NO_STRIDES = False
  
      # Parameters
      im = iio.imread(test_images / "chelsea.png", ignoregamma=True)
      iio.imsave(fnamebase + ".png", im, interlaced=True)
  
      # Parameter fail
      raises(
          TypeError,
          iio.imread,
          test_images / "chelsea.png",
          notavalidk=True,
      )
      raises(
          TypeError, iio.imsave, fnamebase + ".png", im, notavalidk=True
      )
  
      # Compression
      iio.imsave(fnamebase + "1.png", im, compression=0)
      iio.imsave(fnamebase + "2.png", im, compression=9)
      s1 = os.stat(fnamebase + "1.png").st_size
      s2 = os.stat(fnamebase + "2.png").st_size
      assert s2 < s1
      # Fail
      raises(
          ValueError, iio.imsave, fnamebase + ".png", im, compression=12
      )
  
      # Quantize
      if sys.platform.startswith("darwin"):
          return  # quantization segfaults on my osx VM
      iio.imsave(fnamebase + "1.png", im, quantize=256)
      iio.imsave(fnamebase + "2.png", im, quantize=4)
  
      im = iio.imread(fnamebase + "2.png")  # touch palette read code
      s1 = os.stat(fnamebase + "1.png").st_size
      s2 = os.stat(fnamebase + "2.png").st_size
      assert s1 > s2
      # Fail
      fname = fnamebase + "1.png"
      raises(ValueError, iio.imsave, fname, im[:, :, :3], quantize=300)
      raises(ValueError, iio.imsave, fname, im[:, :, 0], quantize=100)
  
imports: import os
  import shutil
  import sys
  import platform
  import warnings
  import fsspec
  import imageio.plugins
  import imageio.v3
  import imageio.v2
  import numpy
  import pytest
  from imageio import core
  from imageio.core import IS_PYPY
  from pytest import raises
  from conftest import deprecated_test
label_desc: Use image node_id 10 for calling a global function with example usage: test_png(setup_library, test_images, tmp_path) without return types