hydrax.image.write_chw#

hydrax.image.write_chw(image: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], array: ndarray, coefs: Coefs | None = None) None#

Writes a PIL image or HWC image data array to the specified NumPy array with shape CHW.

Parameters:
  • image (array_like) – Image data to write.

  • array – Destination array.

  • coefs – Representation conversion coefficients. If not specified, the destination array will have the same representation range as the source image. In the case of a PIL image, that will be [0, 255], which is generally not useful.

Tip

CHW or “channels-first” is the usual format for images in PyTorch.