IDS peak IPL v1.17.1
Loading...
Searching...
No Matches
peak_ipl_image_writer.hpp
Go to the documentation of this file.
1
10
11#pragma once
12
18
19#include <cstdint>
20#include <string>
21
22namespace peak
23{
24namespace ipl
25{
26
27class Image;
28
36class ImageWriter final
37{
38public:
39 ImageWriter() = delete;
40
44 struct PNGParameter final
45 {
47 : Quality(100)
48 {}
49 // Compression parameter from 0 to 100 -> 100 means quality level 0 for PNG
50 uint32_t Quality = 100;
51 };
52
56 struct JPEGParameter final
57 {
59 : Quality(75)
60 {}
61 // Quality parameter from 0 to 100
62 uint32_t Quality = 75;
63 };
64
88 static void WriteAsBMP(const std::string& filePath, const Image& imageToSave);
89
115 static void WriteAsPNG(
116 const std::string& filePath, const Image& imageToSave, const PNGParameter& parameter = PNGParameter());
117
139 static void WriteAsJPG(
140 const std::string& filePath, const Image& imageToSave, const JPEGParameter& parameter = JPEGParameter());
141
159 static void WriteAsRAW(const std::string& filePath, const Image& imageToSave);
160
175 static void Write(const std::string& filePath, const Image& imageToSave);
176};
177
178inline void ImageWriter::WriteAsBMP(const std::string& filePath, const Image& imageToSave)
179{
182 ImageBackendAccessor::BackendHandle(imageToSave), filePath.c_str(), filePath.size());
183 });
184}
185
187 const std::string& filePath, const Image& imageToSave, const PNGParameter& parameter)
188{
191 ImageBackendAccessor::BackendHandle(imageToSave), parameter.Quality, filePath.c_str(), filePath.size());
192 });
193}
194
196 const std::string& filePath, const Image& imageToSave, const JPEGParameter& parameter)
197{
200 ImageBackendAccessor::BackendHandle(imageToSave), parameter.Quality, filePath.c_str(), filePath.size());
201 });
202}
203
204inline void ImageWriter::WriteAsRAW(const std::string& filePath, const Image& imageToSave)
205{
208 ImageBackendAccessor::BackendHandle(imageToSave), filePath.c_str(), filePath.size());
209 });
210}
211
212inline void ImageWriter::Write(const std::string& filePath, const Image& imageToSave)
213{
216 ImageBackendAccessor::BackendHandle(imageToSave), filePath.c_str(), filePath.size());
217 });
218}
219
220} /* namespace ipl */
221} /* namespace peak */
Stores the pixel format, width and height of an image and the pointer to the image buffer.
Definition peak_ipl_image.hpp:47
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:195
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:178
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:186
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:204
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:212
The "peak::ipl" namespace contains the whole image processing library.
void ExecuteAndMapReturnCodes(const CallableType &callableObject)
Definition peak_ipl_exception.hpp:282
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:16
The Parameter for the JPEG writes, e.g. compression quality.
Definition peak_ipl_image_writer.hpp:57
JPEGParameter()
Definition peak_ipl_image_writer.hpp:58
uint32_t Quality
Definition peak_ipl_image_writer.hpp:62
The parameter for the PNG writes, e.g. compression quality.
Definition peak_ipl_image_writer.hpp:45
uint32_t Quality
Definition peak_ipl_image_writer.hpp:50
PNGParameter()
Definition peak_ipl_image_writer.hpp:46