hydrax.image.from_srgb_hwc#

hydrax.image.from_srgb_hwc(image: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], coefs: Coefs, *, mode: str | None = None, copy: bool = False) Image#

Creates a PIL image from sRGB image data in the HWC format, using the specified coefficients for byte conversion.

Parameters:
  • image (array_like) – Image data.

  • coefs – Inverse representation conversion coefficients. Inverse coefficients are expected so that additional sets of coefficients don’t need to be provided in this module.

  • mode – PIL image mode, such as "RGB", "RGBA", or "RGBa". If not specified, the mode is inferred from the shape of the image data.

  • copy – If False, the default, image is modified in-place prior to the datatype conversion. Otherwise, a copy is first made, which has a performance impact. In some cases, a copy must be made.

Pixel values outside the range [0, 255] will be clipped and fractional values will be appropriately rounded. NumPy will produce a warning if any NaN values are encountered and substitute 0.

Caution

Specify copy = True if you intend to use image in subsequent operations.