code: def rescale_pixel_intensity(
      img,
      input_low=0,
      input_high=255,
      output_low=0,
      output_high=255,
      output_type=None,
  ):
      if not isinstance(img, np.ndarray):
          raise ValueError(
              "rescale_pixel_intensity() supports only numpy.ndarray as input"
          )
  
      if output_type is None:
          output_type = img.dtype
  
      if input_low == output_low and output_low == output_high:
          return np.asarray(img, output_type)
  
      # [input_low, input_high] -> [0, input_high - input_low] -> [0, 1]
      normalized = normalize_pixel_intensity(img, input_low, input_high)
  
      # [0, 1] -> [0, output_high - output_low] -> [output_low, output_high]
      scaled = normalized * (output_high - output_low) + output_low
  
      return scaled.astype(output_type)
  
file_path: nnabla/python/src/nnabla/utils/image_utils/backend_events/common.py
imports: from __future__ import division, absolute_import
  import numpy
  from nnabla.logger import logger
label_desc: Use image node_id 2 for calling a global function with example usage: rescale_pixel_intensity(img, input_low, input_high, output_low, output_high, output_type) and returns: scaled, np