Gamma Correction

Description

Function gtrans and ftrans provide gamma correction which can be used to switch between sRGB and linearised sRGB (RGB).

The standard value of gamma for sRGB displays is approximately 2.2, but more accurately is a combination of a linear transform and a power transform with exponent 2.4. gtrans maps linearised sRGB to sRGB, ftrans provides the inverse mapping.

Usage

colorlib.gtrans(u, gamma)

Arguments

unumpy.ndarray
Float array of length N.
gammafloat, numpy.ndarray
gamma value; if float or numpy.ndarray of length one, gamma will be recycled if needed.

Return

numpy.ndarray: Gamma corrected values, same length as input u.