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

Image()
Default constructor (empty image)
Image(int w, int h)
Size Constructor (sets width and height)
Image(int w, int h, const T& v)
Construct an image of a fixed size and initialize all pixels.

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) -> 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)

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
Returns True if the file saved successfully