Simd Library Documentation.

Home | Release Notes | Download | Documentation | Issues | GitHub

Image IO (Save/Load) operations. More...

Functions

SIMD_API uint8_t * SimdImageSaveToMemory (const uint8_t *src, size_t stride, size_t width, size_t height, SimdPixelFormatType format, SimdImageFileType file, int quality, size_t *size)
 Saves an image to memory in given image file format. More...
 
SIMD_API SimdBool SimdImageSaveToFile (const uint8_t *src, size_t stride, size_t width, size_t height, SimdPixelFormatType format, SimdImageFileType file, int quality, const char *path)
 Saves an image to file in given image file format. More...
 
SIMD_API uint8_t * SimdNv12SaveAsJpegToMemory (const uint8_t *y, size_t yStride, const uint8_t *uv, size_t uvStride, size_t width, size_t height, SimdYuvType yuvType, int quality, size_t *size)
 Saves image in NV12 format to memory as JPEG. More...
 
SIMD_API uint8_t * SimdYuv420pSaveAsJpegToMemory (const uint8_t *y, size_t yStride, const uint8_t *u, size_t uStride, const uint8_t *v, size_t vStride, size_t width, size_t height, SimdYuvType yuvType, int quality, size_t *size)
 Saves image in YUV420P format to memory as JPEG. More...
 
SIMD_API uint8_t * SimdImageLoadFromMemory (const uint8_t *data, size_t size, size_t *stride, size_t *width, size_t *height, SimdPixelFormatType *format)
 Loads an image from memory buffer. More...
 
SIMD_API uint8_t * SimdImageLoadFromFile (const char *path, size_t *stride, size_t *width, size_t *height, SimdPixelFormatType *format)
 Loads an image from file. More...
 

Detailed Description

Image IO (Save/Load) operations.

Function Documentation

◆ SimdImageSaveToMemory()

uint8_t * SimdImageSaveToMemory ( const uint8_t *  src,
size_t  stride,
size_t  width,
size_t  height,
SimdPixelFormatType  format,
SimdImageFileType  file,
int  quality,
size_t *  size 
)

Saves an image to memory in given image file format.

Parameters
[in]src- a pointer to pixels data of input image.
[in]stride- a row size of input image in bytes.
[in]width- a width of input image.
[in]height- a height of input image.
[in]format- a pixel format of input image. Supported pixel formats: SimdPixelFormatGray8, SimdPixelFormatBgr24, SimdPixelFormatBgra32, SimdPixelFormatRgb24, SimdPixelFormatRgba32.
[in]file- a format of output image file. To auto choise format of output file set this parameter to SimdImageFileUndefined.
[in]quality- a parameter of compression quality (if file format supports it).
[out]size- a pointer to the size of output image file in bytes.
Returns
a pointer to memory buffer with output image file. It has to be deleted after use by function SimdFree. On error it returns NULL.

◆ SimdImageSaveToFile()

SimdBool SimdImageSaveToFile ( const uint8_t *  src,
size_t  stride,
size_t  width,
size_t  height,
SimdPixelFormatType  format,
SimdImageFileType  file,
int  quality,
const char *  path 
)

Saves an image to file in given image file format.

Note
This function has a C++ wrapper Simd::View::Save(const std::string & path, SimdImageFileType type = SimdImageFileUndefined, int quality = 100).
Parameters
[in]src- a pointer to pixels data of input image.
[in]stride- a row size of input image in bytes.
[in]width- a width of input image.
[in]height- a height of input image.
[in]format- a pixel format of input image. Supported pixel formats: SimdPixelFormatGray8, SimdPixelFormatBgr24, SimdPixelFormatBgra32, SimdPixelFormatRgb24, SimdPixelFormatRgba32.
[in]file- a format of output image file. To auto choise format of output file set this parameter to SimdImageFileUndefined.
[in]quality- a parameter of compression quality (if file format supports it).
[in]path- a path to output image file.
Returns
result of the operation.

◆ SimdNv12SaveAsJpegToMemory()

uint8_t * SimdNv12SaveAsJpegToMemory ( const uint8_t *  y,
size_t  yStride,
const uint8_t *  uv,
size_t  uvStride,
size_t  width,
size_t  height,
SimdYuvType  yuvType,
int  quality,
size_t *  size 
)

Saves image in NV12 format to memory as JPEG.

Parameters
[in]y- a pointer to pixels data of input 8-bit image with Y color plane.
[in]yStride- a row size of the y image.
[in]uv- a pointer to pixels data of input 8-bit image with UV color plane.
[in]uvStride- a row size of the uv image.
[in]width- a width of input image. It must be even number.
[in]height- a height of input image. It must be even number.
[in]yuvType- a type of input YUV image(see descriprion of::SimdYuvType). Now only SimdYuvTrect871 (T-REC-T.871 format) is supported.
[in]quality- a parameter of compression quality.
[out]size- a pointer to the size of output image file in bytes.
Returns
a pointer to memory buffer with output image file. It has to be deleted after use by function SimdFree. On error it returns NULL.

◆ SimdYuv420pSaveAsJpegToMemory()

uint8_t * SimdYuv420pSaveAsJpegToMemory ( const uint8_t *  y,
size_t  yStride,
const uint8_t *  u,
size_t  uStride,
const uint8_t *  v,
size_t  vStride,
size_t  width,
size_t  height,
SimdYuvType  yuvType,
int  quality,
size_t *  size 
)

Saves image in YUV420P format to memory as JPEG.

Parameters
[in]y- a pointer to pixels data of input 8-bit image with Y color plane.
[in]yStride- a row size of the y image.
[in]u- a pointer to pixels data of input 8-bit image with U color plane.
[in]uStride- a row size of the u image.
[in]v- a pointer to pixels data of input 8-bit image with V color plane.
[in]vStride- a row size of the v image.
[in]width- a width of input image. It must be even number.
[in]height- a height of input image. It must be even number.
[in]yuvType- a type of input YUV image(see descriprion of::SimdYuvType). Now only SimdYuvTrect871 (T-REC-T.871 format) is supported.
[in]quality- a parameter of compression quality.
[out]size- a pointer to the size of output image file in bytes.
Returns
a pointer to memory buffer with output image file. It has to be deleted after use by function SimdFree. On error it returns NULL.

◆ SimdImageLoadFromMemory()

uint8_t * SimdImageLoadFromMemory ( const uint8_t *  data,
size_t  size,
size_t *  stride,
size_t *  width,
size_t *  height,
SimdPixelFormatType format 
)

Loads an image from memory buffer.

Note
This function has a C++ wrapper Simd::View::Load(const uint8_t * src, size_t size, Simd::View::Format format = Simd::View::None).
Parameters
[in]data- a pointer to memory buffer with input image file.
[in]size- a size of input image file in bytes.
[out]stride- a pointer to row size of output image in bytes.
[out]width- a pointer to width of output image.
[out]height- a pointer to height of output image.
[in,out]format- a pointer to pixel format of output image. Here you can set desired pixel format (it can be SimdPixelFormatGray8, SimdPixelFormatBgr24, SimdPixelFormatBgra32, SimdPixelFormatRgb24, SimdPixelFormatRgba32). Or set SimdPixelFormatNone and use pixel format of input image file.
Returns
a pointer to pixels data of output image. It has to be deleted after use by function SimdFree. On error it returns NULL.

◆ SimdImageLoadFromFile()

uint8_t * SimdImageLoadFromFile ( const char *  path,
size_t *  stride,
size_t *  width,
size_t *  height,
SimdPixelFormatType format 
)

Loads an image from file.

Note
This function has a C++ wrapper Simd::View::Load(const std::string & path, Simd::View::Format format = Simd::View::None).
Parameters
[in]path- a path to input image file.
[out]stride- a pointer to row size of output image in bytes.
[out]width- a pointer to width of output image.
[out]height- a pointer to height of output image.
[in,out]format- a pointer to pixel format of output image. Here you can set desired pixel format (it can be SimdPixelFormatGray8, SimdPixelFormatBgr24, SimdPixelFormatBgra32, SimdPixelFormatRgb24, SimdPixelFormatRgba32). Or set SimdPixelFormatNone and use pixel format of input image file.
Returns
a pointer to pixels data of output image. It has to be deleted after use by function SimdFree. On error it returns NULL.