#include <darts/image.h>
template<typename T>
Image class
An image with a generic pixel type.
Base classes
-
template<typename T>class Array2d<T>
- Generic, resizable, 2D array class.
Public static functions
- static auto loadable_formats() -> std::set<std::string>
- Set of supported formats for image loading.
- static auto savable_formats() -> std::set<std::string>
- Set of supported formats for image saving.
Constructors, destructors, conversion operators
Public functions
- auto load(const std::string& filename, bool raw = false) -> bool
- Load an image from file.
-
auto save(const std::string& filename,
float gain = 1.0f,
const nlohmann::
json& metadata = nlohmann:: json{}) -> bool - Save an image to the specified filename.
Function documentation
template<typename T>
Image<T>:: Image(int w,
int h)
Size Constructor (sets width and height)
| Parameters | |
|---|---|
| w | The width of the image |
| h | The height of the image |
template<typename T>
Image<T>:: Image(int w,
int h,
const T& v)
Construct an image of a fixed size and initialize all pixels.
| Parameters | |
|---|---|
| w | The width of the image |
| h | The height of the image |
| v | The Color to set all pixels |
template<typename T>
bool Image<T>:: load(const std::string& filename,
bool raw = false)
Load an image from file.
| Parameters | |
|---|---|
| filename | The filename |
| raw | If set to true, this will bypass the sRGB to linear conversion |
| Returns | True if the file loaded successfully |
template<typename T>
bool Image<T>:: save(const std::string& filename,
float gain = 1.0f,
const nlohmann:: json& metadata = nlohmann:: json{})
Save an image to the specified filename.
| Parameters | |
|---|---|
| filename | The filename to save to |
| gain | The multiplicative gain to apply to pixel values before saving |
| metadata | Optional metadata to include in the saved file (only supported in EXR files) |
| Returns | True if the file saved successfully |