### Navigation

- index
- modules |
- modules |
- next |
- previous |
- SciPy v0.9 Reference Guide (DRAFT) »
- Miscellaneous routines (`scipy.misc`) »

# scipy.misc.bytescale

`scipy.misc.``bytescale`(data, cmin=None, cmax=None, high=255, low=0)

  Byte scales an array (image).

  Parameters : | data : ndarray PIL image data array. cmin : Scalar Bias scaling of small values, Default is data.min(). cmax : scalar Bias scaling of large values, Default is data.max(). high : scalar Scale max value to high. low : scalar Scale min value to low.
  Returns : | img_array : ndarray Bytescaled array.

  Examples

      >>> img = array([[ 91.06794177,   3.39058326,  84.4221549 ],
                       [ 73.88003259,  80.91433048,   4.88878881],
                       [ 51.53875334,  34.45808177,  27.5873488 ]])
      >>> bytescale(img)
      array([[255,   0, 236],
             [205, 225,   4],
             [140,  90,  70]], dtype=uint8)
      >>> bytescale(img, high=200, low=100)
      array([[200, 100, 192],
             [180, 188, 102],
             [155, 135, 128]], dtype=uint8)
      >>> bytescale(img, cmin=0, cmax=255)
      array([[91,  3, 84],
             [74, 81,  5],
             [52, 34, 28]], dtype=uint8)

### Navigation

- index
- modules |
- modules |
- next |
- previous |
- SciPy v0.9 Reference Guide (DRAFT) »
- Miscellaneous routines (`scipy.misc`) »