This class implements read and write functions for all file formats supported by the Special media library.
More...
|
static Frame | decodeImage (const void *buffer, const size_t size, const std::string &imageBufferTypeIn=std::string(), std::string *imageBufferTypeOut=nullptr) |
| Decodes (reads/loads) an image from a given binary buffer. More...
|
|
static bool | encodeImage (const Frame &frame, const std::string &imageType, std::vector< uint8_t > &buffer, const bool allowConversion=true, bool *hasBeenConverted=nullptr) |
| Encodes (writes) a given frame as image (with specified image type) to a resulting buffer. More...
|
|
static Frame | readImage (const std::string &filename) |
| Reads/loads an image from a specified file. More...
|
|
static bool | writeImage (const Frame &frame, const std::string &filename, const bool allowConversion=true, bool *hasBeenConverted=nullptr) |
| Writes a given frame to a specified file. More...
|
|
This class implements read and write functions for all file formats supported by the Special media library.
◆ decodeImage()
static Frame Ocean::Media::Special::Image::decodeImage |
( |
const void * |
buffer, |
|
|
const size_t |
size, |
|
|
const std::string & |
imageBufferTypeIn = std::string() , |
|
|
std::string * |
imageBufferTypeOut = nullptr |
|
) |
| |
|
static |
Decodes (reads/loads) an image from a given binary buffer.
- Parameters
-
buffer | The buffer from which the image will be loaded, must be valid |
size | The size of the given buffer in bytes, with range [1, infinity) |
imageBufferTypeIn | Type of the given image that is stored in the buffer, should be specified if known (e.g. the file extension of a corresponding image file) |
imageBufferTypeOut | Optional type of the given image that is stored in the buffer, as determined by the decoder (if possible) |
- Returns
- The frame containing the image information, an invalid frame if the image could not be loaded
- See also
- writeImage().
◆ encodeImage()
static bool Ocean::Media::Special::Image::encodeImage |
( |
const Frame & |
frame, |
|
|
const std::string & |
imageType, |
|
|
std::vector< uint8_t > & |
buffer, |
|
|
const bool |
allowConversion = true , |
|
|
bool * |
hasBeenConverted = nullptr |
|
) |
| |
|
static |
Encodes (writes) a given frame as image (with specified image type) to a resulting buffer.
- Parameters
-
frame | The frame to be written, must be valid |
imageType | The file extension of the image to be created (e.g. jpg, png, bmp, or tif), must be defined |
buffer | The resulting buffer storing the binary information of the BMP image |
allowConversion | True, to allow an internal conversion of the frame if BMP does not support the given frame type; False, to prevent a conversion and to stop creating the buffer |
hasBeenConverted | Optional resulting statement whether the frame had to be converted to a different pixel format before it could be written; True, if so; False, if not |
- Returns
- True, if succeeded; False, if the frame could not be written as BMP image e.g., if the frame contained an alpha channel
- See also
- readImage().
◆ readImage()
static Frame Ocean::Media::Special::Image::readImage |
( |
const std::string & |
filename | ) |
|
|
static |
Reads/loads an image from a specified file.
- Parameters
-
filename | The name of the file from which the image will be loaded, must be valid |
- Returns
- The frame containing the image information, an invalid frame if the image could not be loaded
- See also
- writeImage().
◆ writeImage()
static bool Ocean::Media::Special::Image::writeImage |
( |
const Frame & |
frame, |
|
|
const std::string & |
filename, |
|
|
const bool |
allowConversion = true , |
|
|
bool * |
hasBeenConverted = nullptr |
|
) |
| |
|
static |
Writes a given frame to a specified file.
- Parameters
-
frame | The frame to be written, must be valid |
filename | The name of the file to which the frame will be written, must contain a valid image extension like e.g. jpg, png, bmp, or tif), must be valid |
allowConversion | True, to allow an internal conversion of the frame if BMP does not support the given frame type; False, to prevent a conversion and to stop creating the buffer |
hasBeenConverted | Optional resulting statement whether the frame had to be converted to a different pixel format before it could be written; True, if so; False, if not |
- Returns
- True, if succeeded
- See also
- readImage().
The documentation for this class was generated from the following file: