code: def save_diff_image(expected, actual, output):
      expectedImage = _png.read_png(expected)
      actualImage = _png.read_png(actual)
      actualImage, expectedImage = crop_to_same(
          actual, actualImage, expected, expectedImage
      )
      expectedImage = np.array(expectedImage).astype(float)
      actualImage = np.array(actualImage).astype(float)
      if expectedImage.shape != actualImage.shape:
          raise ImageComparisonFailure(
              "Image sizes do not match expected size: {0} "
              "actual size {1}".format(
                  expectedImage.shape, actualImage.shape
              )
          )
      absDiffImage = np.abs(expectedImage - actualImage)
  
      # expand differences in luminance domain
      absDiffImage *= 255 * 10
      save_image_np = np.clip(absDiffImage, 0, 255).astype(np.uint8)
      height, width, depth = save_image_np.shape
  
      # The PDF renderer doesn't produce an alpha channel, but the
      # matplotlib PNG writer requires one, so expand the array
      if depth == 3:
          with_alpha = np.empty((height, width, 4), dtype=np.uint8)
          with_alpha[:, :, 0:3] = save_image_np
          save_image_np = with_alpha
  
      # Hard-code the alpha channel to fully solid
      save_image_np[:, :, 3] = 255
  
      _png.write_png(save_image_np, output)
  
imports: from __future__ import absolute_import, division, print_function
  import six
  import atexit
  import functools
  import hashlib
  import itertools
  import os
  import re
  import shutil
  import sys
  from tempfile import TemporaryFile
  import numpy
  import matplotlib
  from matplotlib.compat import subprocess
  from matplotlib.testing.exceptions import ImageComparisonFailure
  from matplotlib import _png
  from matplotlib import _get_cachedir
  from matplotlib import cbook
label_desc: Use image node_id 14 for calling a global function with example usage: save_diff_image(expected, actual, output) without return types