code: def test_imshow_compression(level):
      _, grid_img = np.mgrid[0:10, 0:100]
      grid_img = grid_img.astype(np.uint8)
      fig = px.imshow(
          grid_img,
          binary_string=True,
          binary_compression_level=level,
          contrast_rescaling="infer",
      )
      decoded_img = decode_image_string(fig.data[0].source)
      assert np.all(decoded_img == grid_img)
      if level > 0:
          assert len(fig.data[0].source) < grid_img.size
      else:
          assert len(fig.data[0].source) > grid_img.size
  
imports: import plotly.express
  import numpy
  import pytest
  import xarray
  from PIL import Image
  from io import BytesIO
  import base64
  import datetime
  from plotly.express.imshow_utils import rescale_intensity
label_desc: Use image node_id 22 for calling a global function with example usage: test_imshow_compression(level) without return types