All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Static Public Member Functions | List of all members
Pylon::CImagePersistence Class Reference

Contains static functions supporting loading and saving of images. More...

#include <pylon/ImagePersistence.h>

Static Public Member Functions

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. More...
 
static void Save (EImageFileFormat imageFileFormat, const String_t &filename, const IImage &image, CImagePersistenceOptions *pOptions=NULL)
 Saves the image to disk. More...
 
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. More...
 
static bool CanSaveWithoutConversion (EImageFileFormat imageFileFormat, const IImage &image)
 Can be used to check whether the image can be saved without prior conversion. More...
 
static void Load (const String_t &filename, IReusableImage &image)
 Loads an image from disk. More...
 
static void LoadFromMemory (const void *pBuffer, size_t bufferSizeBytes, IReusableImage &image)
 Loads an image from memory. More...
 

Detailed Description

Contains static functions supporting loading and saving of images.

Member Function Documentation

static bool Pylon::CImagePersistence::CanSaveWithoutConversion ( EImageFileFormat  imageFileFormat,
EPixelType  pixelType,
uint32_t  width,
uint32_t  height,
size_t  paddingX,
EImageOrientation  orientation 
)
static

Can be used to check whether the given image can be saved without prior conversion.

See the CImagePersistence::CanSaveWithoutConversion( EImageFileFormat, const IImage&) method documentation for a list of supported pixel formats.

Parameters
[in]imageFileFormatThe target file format for the image to save.
[in]pixelTypeThe pixel type of the image to save.
[in]widthThe number of pixels in a row of the image to save.
[in]heightThe number of rows of the image to save.
[in]paddingXThe number of extra data bytes at the end of each row.
[in]orientationThe vertical orientation of the image in the image buffer.
Returns
Returns true if the image can be saved without prior conversion.
Error Safety:
Does not throw C++ exceptions.
static bool Pylon::CImagePersistence::CanSaveWithoutConversion ( EImageFileFormat  imageFileFormat,
const IImage image 
)
static

Can be used to check whether the image can be saved without prior conversion.

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
Parameters
[in]imageFileFormatThe target file format for the image to save.
[in]imageThe image to save, e.g. a CPylonImage, CPylonBitmapImage, or Grab Result Smart Pointer object.
Returns
Returns true if the image can be saved without prior conversion.
Error Safety:
Does not throw C++ exceptions.
static void Pylon::CImagePersistence::Load ( const String_t filename,
IReusableImage image 
)
static

Loads an image from disk.

The orientation of loaded images is always ImageOrientation_TopDown.

Parameters
[in]filenameName and path of the image.
[in]imageThe 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.
static void Pylon::CImagePersistence::LoadFromMemory ( const void *  pBuffer,
size_t  bufferSizeBytes,
IReusableImage image 
)
static

Loads an image from memory.

The orientation of loaded images is always ImageOrientation_TopDown. Currently BMP, JPEG & PNG images are supported.

Parameters
[in]pBufferThe pointer to the buffer of the source image.
[in]bufferSizeBytesThe size of the buffer of the source image.
[in]imageThe 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.
static void Pylon::CImagePersistence::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 
)
static

Saves the image to disk.

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.

Parameters
[in]imageFileFormatThe file format to save the image in.
[in]filenameName and path of the image.
[in]pBufferThe pointer to the buffer of the image.
[in]bufferSizeThe size of the buffer in byte.
[in]pixelTypeThe pixel type of the image to save.
[in]widthThe number of pixels in a row of the image to save.
[in]heightThe number of rows of the image to save.
[in]paddingXThe number of extra data bytes at the end of each row.
[in]orientationThe vertical orientation of the image in the image buffer.
[in]pOptionsAdditional 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.
static void Pylon::CImagePersistence::Save ( EImageFileFormat  imageFileFormat,
const String_t filename,
const IImage image,
CImagePersistenceOptions pOptions = NULL 
)
static

Saves the image to disk.

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.

Parameters
[in]imageFileFormatThe target file format for the image to save.
[in]filenameName and path of the image.
[in]imageThe image to save, e.g. a CPylonImage, CPylonBitmapImage, or Grab Result Smart Pointer object.
[in]pOptionsAdditional 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.

The documentation for this class was generated from the following file:

pylon 5.0.5
Copyright © 2006-2016 Basler AG (Thu Aug 11 2016 18:01:28)