TIFF I/O

inline std::pair<Image<RGB>, Image<float>> huira::read_image_tiff_rgb(const fs::path &filepath, bool read_alpha)

Reads a TIFF file and returns linear RGB + optional alpha data.

Convenience overload that reads the file into memory and forwards to the buffer-based implementation.

inline std::pair<Image<RGB>, Image<float>> huira::read_image_tiff_rgb(const unsigned char *data, std::size_t size, bool read_alpha)

Reads a TIFF from an in-memory buffer and returns linear RGB + optional alpha data.

Interprets the TIFF data as RGB color:

  • 1-channel: promoted to RGB (equal values in all channels)

  • 3-channel: interpreted as RGB directly

  • 4-channel with alpha: RGB + separate alpha

  • Other channel counts: throws an error

Parameters:
  • data – Pointer to the TIFF data in memory

  • size – Size of the data in bytes

  • read_alpha – If false, alpha channel is not extracted even if present

Returns:

A pair containing the linear RGB image and an optional alpha image.

inline std::pair<Image<float>, Image<float>> huira::read_image_tiff_mono(const fs::path &filepath, bool read_alpha)

Reads a TIFF file and returns linear mono + optional alpha data.

Convenience overload that reads the file into memory and forwards to the buffer-based implementation.

inline std::pair<Image<float>, Image<float>> huira::read_image_tiff_mono(const unsigned char *data, std::size_t size, bool read_alpha)

Reads a TIFF from an in-memory buffer and returns linear mono + optional alpha data.

Interprets the TIFF data as single-channel:

  • 1-channel: returned directly

  • 3-channel: averaged to mono

  • Other channel counts (excluding alpha): throws an error

Parameters:
  • data – Pointer to the TIFF data in memory

  • size – Size of the data in bytes

  • read_alpha – If false, alpha channel is not extracted even if present

Returns:

A pair containing the linear mono image and an optional alpha image.