code: def soft_alpha_blend(
      image_with_alpha, amount_background=0.333, gamma=2.2
  ):
      assert image_with_alpha.shape[-1] == 4
  
      alpha = image_with_alpha[..., -1][..., np.newaxis]
      rgb = image_with_alpha[..., :3]
      white = np.ones_like(rgb)
      background = (
          amount_background * rgb + (1 - amount_background) * white
      )
      blended = np.power(
          (
              alpha * np.power(rgb, gamma)
              + (1 - alpha) * np.power(background, gamma)
          ),
          1 / gamma,
      )
      return blended
  
imports: from __future__ import absolute_import, division, print_function
  import numpy
  from scipy import ndimage
label_desc: Use image node_id 3 for calling a global function with example usage: soft_alpha_blend(image_with_alpha, amount_background, gamma) and returns: blended