Saving Images

A collection of functions to store image buffers as in various types of images files. More...

Data Structures

struct   IC4_IMAGEBUFFER_SAVE_OPTIONS_BMP

Contains image file storage options for bitmap files. More...

struct  IC4_IMAGEBUFFER_SAVE_OPTIONS_PNG

Contains image file storage options for PNG files. More...

struct  IC4_IMAGEBUFFER_SAVE_OPTIONS_JPEG

Contains image file storage options for Jpeg files. More...

struct  IC4_IMAGEBUFFER_SAVE_OPTIONS_TIFF

Contains image file storage options for TIFF files. More...

Enumerations

enum   IC4_PNG_COMPRESSION_LEVEL {
  IC4_PNG_COMPRESSION_AUTO , IC4_PNG_COMPRESSION_LOW , IC4_PNG_COMPRESSION_MEDIUM , IC4_PNG_COMPRESSION_HIGH ,
  IC4_PNG_COMPRESSION_HIGHEST
}

Defines the possible PNG file compression levels. More...

Functions

bool  ic4_imagebuffer_save_as_bmp (struct IC4_IMAGE_BUFFER *pImageBuffer, const char *file_path, const struct IC4_IMAGEBUFFER_SAVE_OPTIONS_BMP *options)

Saves an image buffer as a Bitmap file.

bool ic4_imagebuffer_save_as_jpeg (struct IC4_IMAGE_BUFFER *pImageBuffer, const char *file_path, const struct IC4_IMAGEBUFFER_SAVE_OPTIONS_JPEG *options)

Saves an image buffer as a Jpeg file.

bool ic4_imagebuffer_save_as_tiff (struct IC4_IMAGE_BUFFER *pImageBuffer, const char *file_path, const struct IC4_IMAGEBUFFER_SAVE_OPTIONS_TIFF *options)

Saves an image buffer as a Tiff file.

bool  ic4_imagebuffer_save_as_png (struct IC4_IMAGE_BUFFER *pImageBuffer, const char *file_path, const struct IC4_IMAGEBUFFER_SAVE_OPTIONS_PNG *options)

Saves an image buffer as a PNG file.

Detailed Description

A collection of functions to store image buffers as in various types of images files.

The supported files formats include

  • Bitmap
  • Jpeg
  • Tiff
  • Png

For each file format, there is a separate function to save the image buffer in a file, for example ic4_imagebuffer_save_as_bmp() or ic4_imagebuffer_save_as_jpeg()

Enumeration Type Documentation

◆ IC4_PNG_COMPRESSION_LEVEL

Defines the possible PNG file compression levels.

Higher compression levels can generate smaller files, but the compression can take more time.

Enumerator
IC4_PNG_COMPRESSION_AUTO 

Automatically select a compression level.

IC4_PNG_COMPRESSION_LOW 

Low compression.

IC4_PNG_COMPRESSION_MEDIUM 

Medium compression.

IC4_PNG_COMPRESSION_HIGH 

High compression.

IC4_PNG_COMPRESSION_HIGHEST 

Highest compression.

Function Documentation

◆ ic4_imagebuffer_save_as_bmp()

bool ic4_imagebuffer_save_as_bmp ( struct IC4_IMAGE_BUFFER pImageBuffer,
const char *  file_path,
const struct IC4_IMAGEBUFFER_SAVE_OPTIONS_BMP options 
)

Saves an image buffer as a Bitmap file.

Parameters
[in]pImageBufferAn image buffer
[in]file_pathPath of the image file
[in]optionsOptions structure configuring the save operation
Note
Depending on the pixel format of the image buffer, a transformation is applied before saving the image.
  • Monochrome pixel formats are converted to Mono8 and stored as a 8-bit monochrome bitmap file
  • Bayer, RGB and YUV pixel formats are converted to BGR8 and stored as a 24-bit color bitmap file
Returns
true on success, otherwise false.
Use ic4_get_last_error() to query error information.

◆ ic4_imagebuffer_save_as_jpeg()

bool ic4_imagebuffer_save_as_jpeg ( struct IC4_IMAGE_BUFFER pImageBuffer,
const char *  file_path,
const struct IC4_IMAGEBUFFER_SAVE_OPTIONS_JPEG options 
)

Saves an image buffer as a Jpeg file.

Parameters
[in]pImageBufferAn image buffer
[in]file_pathPath of the image file
[in]optionsOptions structure configuring the save operation
Note
Depending on the pixel format of the image buffer, a transformation is applied before saving the image.
  • Monochrome pixel formats are converted to Mono8 and stored as a monochrome jpeg file
  • Bayer, RGB and YUV pixel formats are converted to BGR8 stored as a color jpeg file
Returns
true on success, otherwise false.
Use ic4_get_last_error() to query error information.

◆ ic4_imagebuffer_save_as_png()

bool ic4_imagebuffer_save_as_png ( struct IC4_IMAGE_BUFFER pImageBuffer,
const char *  file_path,
const struct IC4_IMAGEBUFFER_SAVE_OPTIONS_PNG options 
)

Saves an image buffer as a PNG file.

Parameters
[in]pImageBufferAn image buffer
[in]file_pathPath of the image file
[in]optionsOptions structure configuring the save operation
Note
Depending on the pixel format of the image buffer, a transformation is applied before saving the image.
  • Monochrome pixel formats with a bit depth higher than 8bpp are converted to Mono16 and stored as a monochrome PNG file with 16 bits per channel
  • Mono8 image buffers are stored as a monochrome PNG file with 8 bits per channel
  • Bayer format with a bit depth higher than 8bpp are converted to BGRa16 and stored as a 4-channel PNG with 16 bits per channel
  • 8-bit Bayer, RGB and YUV pixel formats are converted to BGR8 stored as a 3-channel PNG file with 8 bits per channel
Returns
true on success, otherwise false.
Use ic4_get_last_error() to query error information.

◆ ic4_imagebuffer_save_as_tiff()

bool ic4_imagebuffer_save_as_tiff ( struct IC4_IMAGE_BUFFER pImageBuffer,
const char *  file_path,
const struct IC4_IMAGEBUFFER_SAVE_OPTIONS_TIFF options 
)

Saves an image buffer as a Tiff file.

Parameters
[in]pImageBufferAn image buffer
[in]file_pathPath of the image file
[in]optionsOptions structure configuring the save operation
Note
Depending on the pixel format of the image buffer, a transformation is applied before saving the image.
  • Monochrome pixel formats with a bit depth higher than 8bpp are converted to Mono16 and stored as a monochrome Tiff file with 16 bits per channel
  • Mono8 image buffers are stored as a monochrome Tiff file with 8 bits per channel
  • Bayer format with a bit depth higher than 8bpp are converted to BGRa16 and stored as a 4-channel Tiff with 16 bits per channel
  • 8-bit Bayer, RGB and YUV pixel formats are converted to BGR8 stored as a 3-channel Tiff file with 8 bits per channel
Returns
true on success, otherwise false.
Use ic4_get_last_error() to query error information.