IDS peak IPL v1.18.0
Loading...
Searching...
No Matches
peak_ipl_image_writer.hpp
Go to the documentation of this file.
1
5
6#pragma once
7
13
14#include <cstdint>
15#include <string>
16
17namespace peak
18{
19namespace ipl
20{
21
22class Image;
23
31class ImageWriter final
32{
33public:
34 ImageWriter() = delete;
35
39 struct PNGParameter final
40 {
42 : Quality(100)
43 {}
44 // Compression parameter from 0 to 100 -> 100 means quality level 0 for PNG
45 uint32_t Quality = 100;
46 };
47
51 struct JPEGParameter final
52 {
54 : Quality(75)
55 {}
56 // Quality parameter from 0 to 100
57 uint32_t Quality = 75;
58 };
59
83 static void WriteAsBMP(const std::string& filePath, const Image& imageToSave);
84
110 static void WriteAsPNG(
111 const std::string& filePath, const Image& imageToSave, const PNGParameter& parameter = PNGParameter());
112
134 static void WriteAsJPG(
135 const std::string& filePath, const Image& imageToSave, const JPEGParameter& parameter = JPEGParameter());
136
154 static void WriteAsRAW(const std::string& filePath, const Image& imageToSave);
155
170 static void Write(const std::string& filePath, const Image& imageToSave);
171};
172
173inline void ImageWriter::WriteAsBMP(const std::string& filePath, const Image& imageToSave)
174{
177 ImageBackendAccessor::BackendHandle(imageToSave), filePath.c_str(), filePath.size());
178 });
179}
180
182 const std::string& filePath, const Image& imageToSave, const PNGParameter& parameter)
183{
186 ImageBackendAccessor::BackendHandle(imageToSave), parameter.Quality, filePath.c_str(), filePath.size());
187 });
188}
189
191 const std::string& filePath, const Image& imageToSave, const JPEGParameter& parameter)
192{
195 ImageBackendAccessor::BackendHandle(imageToSave), parameter.Quality, filePath.c_str(), filePath.size());
196 });
197}
198
199inline void ImageWriter::WriteAsRAW(const std::string& filePath, const Image& imageToSave)
200{
203 ImageBackendAccessor::BackendHandle(imageToSave), filePath.c_str(), filePath.size());
204 });
205}
206
207inline void ImageWriter::Write(const std::string& filePath, const Image& imageToSave)
208{
211 ImageBackendAccessor::BackendHandle(imageToSave), filePath.c_str(), filePath.size());
212 });
213}
214
215} /* namespace ipl */
216} /* namespace peak */
Stores the pixel format, width and height of an image and the pointer to the image buffer.
Definition peak_ipl_image.hpp:42
static void WriteAsJPG(const std::string &filePath, const Image &imageToSave, const JPEGParameter &parameter=JPEGParameter())
Writes the specified image to the filesystem as JPEG image.
Definition peak_ipl_image_writer.hpp:190
static void WriteAsBMP(const std::string &filePath, const Image &imageToSave)
Writes the specified image to the filesystem as BMP image.
Definition peak_ipl_image_writer.hpp:173
static void WriteAsPNG(const std::string &filePath, const Image &imageToSave, const PNGParameter &parameter=PNGParameter())
Writes the specified image to the filesystem as PNG image.
Definition peak_ipl_image_writer.hpp:181
static void WriteAsRAW(const std::string &filePath, const Image &imageToSave)
Writes the specified image to the filesystem as a raw binary image.
Definition peak_ipl_image_writer.hpp:199
static void Write(const std::string &filePath, const Image &imageToSave)
Writes the specified image to the filesystem. The type is specified by the given file ending in file ...
Definition peak_ipl_image_writer.hpp:207
The "peak::ipl" namespace contains the whole image processing library.
void ExecuteAndMapReturnCodes(const CallableType &callableObject)
Definition peak_ipl_exception.hpp:284
PEAK_IPL_C_API PEAK_IPL_ImageWriter_Write(PEAK_IPL_IMAGE_HANDLE inputImageHandle, const char *filePath, size_t filePathSize)
Writes an image to file and selects the format by file ending. In case the format has parameters,...
PEAK_IPL_C_API PEAK_IPL_ImageWriter_WriteAsJPG(PEAK_IPL_IMAGE_HANDLE inputImageHandle, uint32_t quality, const char *filePath, size_t filePathSize)
Writes an image as JPEG image file.
PEAK_IPL_C_API PEAK_IPL_ImageWriter_WriteAsRAW(PEAK_IPL_IMAGE_HANDLE inputImageHandle, const char *filePath, size_t filePathSize)
Writes an image as raw data binary file.
PEAK_IPL_C_API PEAK_IPL_ImageWriter_WriteAsPNG(PEAK_IPL_IMAGE_HANDLE inputImageHandle, uint32_t quality, const char *filePath, size_t filePathSize)
Writes an image as PNG image file.
PEAK_IPL_C_API PEAK_IPL_ImageWriter_WriteAsBMP(PEAK_IPL_IMAGE_HANDLE inputImageHandle, const char *filePath, size_t filePathSize)
Writes an image as BMP image file.
#define PEAK_IPL_C_ABI_PREFIX
Definition peak_ipl_dll_defines.h:11
The Parameter for the JPEG writes, e.g. compression quality.
Definition peak_ipl_image_writer.hpp:52
JPEGParameter()
Definition peak_ipl_image_writer.hpp:53
uint32_t Quality
Definition peak_ipl_image_writer.hpp:57
The parameter for the PNG writes, e.g. compression quality.
Definition peak_ipl_image_writer.hpp:40
uint32_t Quality
Definition peak_ipl_image_writer.hpp:45
PNGParameter()
Definition peak_ipl_image_writer.hpp:41