Please enable JavaScript to view this site.

IDS Software Suite 4.96.1

Windows_Logo
Linux_Logo

USB 2.0

USB 3.x

GigE

USB 2.0

USB 3.x

GigE

Syntax

INT is_ImageFile (HIDS hCam, UINT nCommand, void* pParam, UINT cbSizeOfParam)

Description

hint_info

Note for Linux-systems

For saving images as JPEG or PNG you must install specific libraries under Linux (see https://en.ids-imaging.com/download-ueye.html).

is_ImageFile() loads and save an image from or to a file. The image must be BMP, JPEG or PNG format. The image is loaded into the active image memory or read-out from the active image memory.

hint_info

When saving an image is_FreezeVideo() should not be called with the IS_DONT_WAIT parameter, because the image acquisition might not be completed at the time of saving.

The bitmap is stored with the color depth that was used when allocating the image memory (in DIB mode) or that was set for the current color mode (in Direct3D mode). You can save images with a bit depth of more than 8 bit in the PNG format. 12 bit formats are converted into 16 bit. JPEG files are always saved with a color depth of 8 or 24 bits.

hint_info

In Direct3D or OpenGL mode, overlay data is not saved.

The nCommand input parameter is used to select the function mode. The pParam input parameter depends on the selected function mode. If you select functions for setting or returning a value, pParam contains a pointer to a variable of the UINT type. The size of the memory area to which pParam refers is specified in the cbSizeOfParam input parameter.

Input parameters

hCam

Camera handle

pParam

Pointer to a function parameter, whose function depends on nCommand.

cbSizeOfParam

Size (in bytes) of the memory area to which pParam refers.

Contents of the IMAGE_FILE_PARAMS structure

wchar_t*

pwchFileName

Name of the file to be loaded/saved (Unicode).

If NULL is passed, the "Open file"/"Save as" dialog opens.

UINT

nFileType

File type to be saved/loaded:

IS_IMG_BMP

IS_IMG_JPG

IS_IMG_PNG

UINT

nQuality

PNG/JPEG: Sets the image quality. The higher the value, the better the quality.
100 = best quality (no compression)
If the parameter is set to 0, the the default value of 75 is used.

BMP: the parameter is ignored.

char**

ppcImageMem

When loading:

Pointer to an image memory and pointer to the corresponding ID. If both pointers are NULL the image is loaded into the active image memory. If both pointers are valid a new memory is allocated. This memory must be released with is_FreeImageMem().

When saving:

Pointer to an image memory and pointer to the corresponding ID. If both pointers are NULL the image is saved from the active image memory. If both pointers are valid the corresponding memory is used.

UINT*

pnImageID

BYTE

reserved[32]

reserved

Return values

IS_FILE_READ_INVALID_BMP_ID

The specified file is not a valid bitmap file.

IS_FILE_READ_OPEN_ERROR

The file cannot be opened.

IS_INVALID_PARAMETER

One of the submitted parameters is outside the valid range or is not supported for this sensor or is not available in this mode.

IS_NO_SUCCESS

General error message

IS_NOT_SUPPORTED

The camera model used here does not support this function or setting.

IS_SUCCESS

Function executed successfully

Related functions

is_GetImageMem()

is_SetImageMem()

Example 1

IMAGE_FILE_PARAMS ImageFileParams;
 
ImageFileParams.pwchFileName = NULL;
ImageFileParams.pnImageID = NULL;
ImageFileParams.ppcImageMem = NULL;
ImageFileParams.nQuality = 0;
 
// Load bitmap into active memory (with file open dialog)
ImageFileParams.nFileType = IS_IMG_BMP;
INT nRet = is_ImageFile(m_hCam, IS_IMAGE_FILE_CMD_LOAD, (void*)&ImageFileParams, sizeof(ImageFileParams));
 
// Load jpeg into active memory (with file open dialog)
ImageFileParams.nFileType = IS_IMG_JPG;
nRet = is_ImageFile(m_hCam, IS_IMAGE_FILE_CMD_LOAD, (void*)&ImageFileParams, sizeof(ImageFileParams));
 
// Alloc image memory and load bitmap into it (without file open dialog)
char* pcMemory = NULL;
UINT nID = 0;
ImageFileParams.pwchFileName = L"c:\\test.bmp";
ImageFileParams.pnImageID = &nID;
ImageFileParams.ppcImageMem = &pcMemory;
ImageFileParams.nFileType = IS_IMG_BMP;
nRet = is_ImageFile(m_hCam, IS_IMAGE_FILE_CMD_LOAD, (void*)&ImageFileParams, sizeof(ImageFileParams));

Example 2

IMAGE_FILE_PARAMS ImageFileParams;
 
ImageFileParams.pwchFileName = NULL;
ImageFileParams.pnImageID = NULL;
ImageFileParams.ppcImageMem = NULL;
ImageFileParams.nQuality = 0;
 
// Save bitmap from active memory to file (with file open dialog)
ImageFileParams.nFileType = IS_IMG_BMP;
INT nRet = is_ImageFile(m_hCam, IS_IMAGE_FILE_CMD_SAVE, (void*)&ImageFileParams, sizeof(ImageFileParams));
 
// Save jpeg from active memory with quality 80 (without file open dialog)
ImageFileParams.pwchFileName = L"c:\\test.jpg";
ImageFileParams.nFileType = IS_IMG_JPG;
ImageFileParams.nQuality = 80;
nRet = is_ImageFile(m_hCam, IS_IMAGE_FILE_CMD_SAVE, (void*)&ImageFileParams, sizeof(ImageFileParams));
 
// Save png from special memory with quality 50 (with file open dialog)
ImageFileParams.pwchFileName = NULL;
ImageFileParams.pnImageID = &nID;   // valid ID
ImageFileParams.ppcImageMem = &pcMemory;     // valid buffer
ImageFileParams.nFileType = IS_IMG_PNG;
ImageFileParams.nQuality = 50;
nRet = is_ImageFile(m_hCam, IS_IMAGE_FILE_CMD_SAVE, (void*)&ImageFileParams, sizeof(ImageFileParams));

© 2022 IDS Imaging Development Systems GmbH