Pylon::CImagePersistence#
Contains static functions supporting loading and saving of images.
#include <pylon/ImagePersistence.h>
Public Functions#
Name | |
---|---|
void | Save(EImageFileFormat imageFileFormat, const String_t & filename, const void * pBuffer, size_t bufferSize, EPixelType pixelType, uint32_t width, uint32_t height, size_t paddingX, EImageOrientation orientation, CImagePersistenceOptions * pOptions =NULL) Saves the image to disk. |
void | Save(EImageFileFormat imageFileFormat, const String_t & filename, const IImage & image, CImagePersistenceOptions * pOptions =NULL) Saves the image to disk. |
bool | CanSaveWithoutConversion(EImageFileFormat imageFileFormat, EPixelType pixelType, uint32_t width, uint32_t height, size_t paddingX, EImageOrientation orientation) Can be used to check whether the given image can be saved without prior conversion. |
bool | CanSaveWithoutConversion(EImageFileFormat imageFileFormat, const IImage & image) Can be used to check whether the image can be saved without prior conversion. |
void | Load(const String_t & filename, IReusableImage & image) Loads an image from disk. |
void | LoadFromMemory(const void * pBuffer, size_t bufferSizeBytes, IReusableImage & image) Loads an image from memory. |
Public Functions Documentation#
function Save#
static void Save(
EImageFileFormat imageFileFormat,
const String_t & filename,
const void * pBuffer,
size_t bufferSize,
EPixelType pixelType,
uint32_t width,
uint32_t height,
size_t paddingX,
EImageOrientation orientation,
CImagePersistenceOptions * pOptions =NULL
)
Saves the image to disk.
Parameters:
- imageFileFormat The file format to save the image in.
- filename Name and path of the image.
- pBuffer The pointer to the buffer of the image.
- bufferSize The size of the buffer in byte.
- pixelType The pixel type of the image to save.
- width The number of pixels in a row of the image to save.
- height The number of rows of the image to save.
- paddingX The number of extra data bytes at the end of each row.
- orientation The vertical orientation of the image in the image buffer.
- pOptions Additional options.
Precondition:
- The pixel type of the image to save must be a supported input format of the Pylon::CImageFormatConverter.
- The
width
value must be >= 0 and < _I32_MAX. - The
height
value must be >= 0 and < _I32_MAX.
Error Safety:
Throws an exception if saving the image fails.
Converts the image to a format that can be saved if required.
If required, the image is automatically converted to a new image and then saved. See CanSaveWithoutConversion() for more information. An image with a bit depth higher than 8 bit is stored with 16 bit bit depth if supported by the image file format. In this case the pixel data is MSB aligned.
If more control over the conversion is required then the CImageFormatConverter class can be used to convert the input image before saving it.
Depending on your operating system, the following file types are supported:
- Windows: BMP, JPG, PNG, TIFF
- Linux: PNG, TIFF
function Save#
static void Save(
EImageFileFormat imageFileFormat,
const String_t & filename,
const IImage & image,
CImagePersistenceOptions * pOptions =NULL
)
Saves the image to disk.
Parameters:
- imageFileFormat The target file format for the image to save.
- filename Name and path of the image.
- image The image to save, e.g. a CPylonImage, CPylonBitmapImage, or Grab Result Smart Pointer object.
- pOptions Additional options.
Precondition: The pixel type of the image to save must be a supported input format of the Pylon::CImageFormatConverter.
Error Safety:
Throws an exception if saving the image fails.
Converts the image to a format that can be if required.
If required, the image is automatically converted to a new image and then saved. See CanSaveWithoutConversion() for more information. An image with a bit depth higher than 8 bit is stored with 16 bit bit depth if supported by the image file format. In this case the pixel data is MSB aligned.
If more control over the conversion is required then the CImageFormatConverter class can be used to convert the input image before saving it.
Depending on your operating system, the following file types are supported:
- Windows: BMP, JPG, PNG, TIFF
- Linux: PNG, TIFF
function CanSaveWithoutConversion#
static bool CanSaveWithoutConversion(
EImageFileFormat imageFileFormat,
EPixelType pixelType,
uint32_t width,
uint32_t height,
size_t paddingX,
EImageOrientation orientation
)
Can be used to check whether the given image can be saved without prior conversion.
Parameters:
- imageFileFormat The target file format for the image to save.
- pixelType The pixel type of the image to save.
- width The number of pixels in a row of the image to save.
- height The number of rows of the image to save.
- paddingX The number of extra data bytes at the end of each row.
- orientation The vertical orientation of the image in the image buffer.
Return: Returns true if the image can be saved without prior conversion.
Error Safety:
Does not throw C++ exceptions.
See the CImagePersistence::CanSaveWithoutConversion( EImageFileFormat, const IImage&) method documentation for a list of supported pixel formats.
function CanSaveWithoutConversion#
Can be used to check whether the image can be saved without prior conversion.
Parameters:
- imageFileFormat The target file format for the image to save.
- image The image to save, e.g. a CPylonImage, CPylonBitmapImage, or Grab Result Smart Pointer object.
Return: Returns true if the image can be saved without prior conversion.
Error Safety:
Does not throw C++ exceptions.
Supported formats for TIFF:
- PixelType_Mono8
- PixelType_Mono16
- PixelType_RGB8packed
- PixelType_RGB16packed
Supported formats for BMP, JPEG and PNG:
- PixelType_Mono8
- PixelType_BGR8packed
- PixelType_BGRA8packed
Supported formats for DNG:
- PixelType_BayerGR*
- PixelType_BayerRG*
- PixelType_BayerGB*
- PixelType_BayerBG*
With *: 8, 10, 12, 16, 10p, 12p, 12packed
function Load#
Loads an image from disk.
Parameters:
- filename Name and path of the image.
- image The target image object, e.g. a CPylonImage or CPylonBitmapImage object. When passing a CPylonBitmapImage object the loaded format must be supported by the CPylonBitmapImage class.
Error Safety:
Throws an exception if the image cannot be loaded. The image buffer content is undefined when the loading of the image fails.
The orientation of loaded images is always ImageOrientation_TopDown. Depending on your operating system, the following file types are supported:
- Windows: BMP, JPG, PNG, TIFF
- Linux: PNG, TIFF
function LoadFromMemory#
Loads an image from memory.
Parameters:
- pBuffer The pointer to the buffer of the source image.
- bufferSizeBytes The size of the buffer of the source image.
- image The target image object, e.g. a CPylonImage or CPylonBitmapImage object. When passing a CPylonBitmapImage object the loaded format must be supported by the CPylonBitmapImage class.
Error Safety:
Throws an exception if the image cannot be loaded. The image buffer content is undefined when the loading of the image fails.
The orientation of loaded images is always ImageOrientation_TopDown. Depending on your operating system, the following file types are supported:
- Windows: BMP, JPG, PNG, TIFF
- Linux: PNG, TIFF