68 const std::string &fileName,
69 LoadImageTag<ColorBGRA> );
71 const std::string &fileName,
72 LoadImageTag<ColorRGBA> );
74 const std::string &fileName,
75 LoadImageTag<ColorRGBA_SRGB> );
77 const std::string &fileName,
78 LoadImageTag<ColorBGRA_SRGB> );
87 template<
class PixelFormat>
92 std::is_same_v<PixelFormat, Zivid::ColorRGBA> || std::is_same_v<PixelFormat, Zivid::ColorBGRA>
93 || std::is_same_v<PixelFormat, Zivid::ColorRGBA_SRGB>
94 || std::is_same_v<PixelFormat, Zivid::ColorBGRA_SRGB>,
95 "PixelFormat must be Zivid::ColorRGBA, Zivid::ColorBGRA, Zivid::ColorRGBA_SRGB, or Zivid::ColorBGRA_SRGB");
101 template<
typename Iterator>
129 explicit Image(
const std::string &fileName)
130 :
Image{ Detail::loadImageImpl(fileName, Detail::LoadImageTag<PixelFormat>{}) }
142 void save(
const std::string &fileName)
const
144 return Detail::saveImageImpl(*
this, fileName);
149 :
Array2D<PixelFormat>(std::move(a))
#define ZIVID_CORE_EXPORT
Definition CoreExport.h:56
Two-dimensional container of data.
Definition Array2D.h:83
size_t height() const
Get the height of the array (number of rows)
Definition Array2D.h:106
ConstIterator end() const
Definition Array2D.h:174
size_t width() const
Get the width of the array (number of columns)
Definition Array2D.h:100
ConstIterator begin() const
Definition Array2D.h:168
A 2-dimensional image.
Definition Image.h:89
void save(const std::string &fileName) const
Save the image to a file. The supported file types are PNG (.png), JPEG (.jpg, .jpeg) and BMP (....
Definition Image.h:142
Image(const Resolution &resolution, const unsigned char *begin, const unsigned char *end)
Create an image from an unsigned char byte buffer.
Definition Image.h:119
Image()=default
Create an empty image.
Image(const std::string &fileName)
Load an image from a file.
Definition Image.h:129
Image(const Resolution &resolution, Iterator beginIt, Iterator endIt)
Create an image from a buffer of elements by copy.
Definition Image.h:102
Resolution resolution() const
Get the resolution of the image.
Definition Image.h:135
Class describing a resolution with a width and a height.
Definition Resolution.h:56
The main Zivid namespace. All Zivid code is found here.
Definition Application.h:84