TIFF I/O¶
Reading¶
-
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.
Writing¶
-
inline void huira::write_image_tiff(const fs::path &filepath, const Image<RGB> &image, int bit_depth, const std::string &description, const std::string &artist)¶
Writes an RGB image to a TIFF file with optional metadata.
- Parameters:
filepath – Output file path
image – RGB image to write
bit_depth – Bit depth per channel (8 or 16)
description – Optional image description metadata
artist – Optional artist metadata
-
inline void huira::write_image_tiff(const fs::path &filepath, const Image<float> &image, int bit_depth, const std::string &description, const std::string &artist)¶
Writes a monochrome float image to a TIFF file with optional metadata.
-
template<IsSpectral TSpectral>
inline void huira::write_image_tiff(const fs::path &filepath, const Image<TSpectral> &image, int bit_depth, const std::string &description, const std::string &artist)¶ Writes a spectral image to a TIFF file by converting to mono.