hydrax.image.open_srgb#
- hydrax.image.open_srgb(fp, *, mode: str = 'RGB', convert: tuple[Intent, int] = (Intent.RELATIVE_COLORIMETRIC, 9216), formats: list[str] | tuple[str, ...] | None = None) Image #
Opens an image using PIL and ensures it is in the sRGB colorspace.
- Parameters:
fp (path-like object, file stream, or buffer) – The image to open.
mode – The pixel format for the image. Defaults to
"RGB"
, but could also be"RGBA"
or"RGBa"
.convert (PIL.ImageCMS.Intent, PIL.ImageCMS.Flags) – The colorspace conversion intent and flags for converting to sRGB. The default,
CONVERT_RELATIVE
is usually correct. If the specified intent cannot be used with the image’s embedded color profile, the profile’s default intent is used instead.formats – A list or tuple of formats to attempt to load the file in. See PIL.Image.open for more details.
Tip
After opening an image, you can write it to a
hydrax.Dataloader
loader_func
array usingwrite_hwc()
orwrite_chw()
.