Skip to main content

raygeo.image.srgb

Functions

linear_to_srgb()

linear_to_srgb(
array: numpy.NDArray[numpy.float32],
dither: bool = False,
) -> numpy.NDArray[numpy.uint8]

Convert linear light values to sRGB pixel values.

ParameterTypeDescription
arraynumpy.NDArray[numpy.float32]Input array of linear float32 values in [0, 1].
ditherbool = FalseApply dithering to reduce banding artifacts.
Returnsnumpy.NDArray[numpy.uint8]Array of sRGB uint8 values with the same shape.
ComplexityO(n) where n = number of pixels

srgb_to_linear()

srgb_to_linear(
array: numpy.NDArray[numpy.uint8],
) -> numpy.NDArray[numpy.float32]

Convert sRGB pixel values to linear light values.

ParameterTypeDescription
arraynumpy.NDArray[numpy.uint8]Input array of sRGB uint8 values.
Returnsnumpy.NDArray[numpy.float32]Array of linear float32 values with the same shape.
ComplexityO(n) where n = number of pixels

sRGB to linear round-trip

sRGB to linear round-trip