code: def test_log_image_pillow(subdir):
      from PIL import Image, ImageChops
  
      filename = "image.png"
      artifact_file = (
          filename
          if subdir is None
          else posixpath.join(subdir, filename)
      )
  
      image = Image.new("RGB", (100, 100))
  
      with mlflow.start_run():
          mlflow.log_image(image, artifact_file)
  
          artifact_path = (
              None if subdir is None else posixpath.normpath(subdir)
          )
          artifact_uri = mlflow.get_artifact_uri(artifact_path)
          run_artifact_dir = local_file_uri_to_path(artifact_uri)
          assert os.listdir(run_artifact_dir) == [filename]
  
          logged_path = os.path.join(run_artifact_dir, filename)
          loaded_image = Image.open(logged_path)
          # How to check Pillow image equality: https://stackoverflow.com/a/6204954/6943581
          assert (
              ImageChops.difference(loaded_image, image).getbbox()
              is None
          )
  
file_path: mlflow/tests/tracking/test_log_image.py
imports: import os
  import posixpath
  from unittest import mock
  import pytest
  import mlflow
  from mlflow.utils.file_utils import local_file_uri_to_path
label_desc: Use image node_id 2 for calling a global function with example usage: test_log_image_pillow(subdir) without return types