ssimMatch = (
  newImageData,
  baselineImageData,
  diffImageData,
  imageWidth,
  imageHeight,
  diffConfig
) => {
  const newImage = { data: newImageData, width: imageWidth, height: imageHeight };
  const baselineImage = { data: baselineImageData, width: imageWidth, height: imageHeight };
  // eslint-disable-next-line camelcase
  const { ssim_map, mssim } = ssim.ssim(newImage, baselineImage, diffConfig);
  // Converts the SSIM value to different pixels based on image width and height
  // conforms to how pixelmatch works.
  const diffPixels = (1 - mssim) * imageWidth * imageHeight;
  const diffRgbaPixels = new DataView(diffImageData.buffer, diffImageData.byteOffset);
  for (let ln = 0; ln !== imageHeight; ++ln) {
    for (let pos = 0; pos !== imageWidth; ++pos) {
      const rpos = (ln * imageWidth) + pos;
      // initial value is transparent.  We'll add in the SSIM offset.
      // red (ff) green (00) blue (00) alpha (00)
      const diffValue = 0xff000000 + Math.floor(0xff *
        (1 - ssim_map.data[
          // eslint-disable-next-line no-mixed-operators
          (ssim_map.width * Math.round(ssim_map.height * ln / imageHeight)) +
          // eslint-disable-next-line no-mixed-operators
          Math.round(ssim_map.width * pos / imageWidth)]));
      diffRgbaPixels.setUint32(rpos * 4, diffValue);
    }
  }
  return diffPixels;
}
Helper function for SSIM comparison that allows us to use the existing diff
config that works with jest-image-snapshot to pass parameters
that will work with SSIM.  It also transforms the parameters to match the spec
required by the SSIM library.