Regular API function

simSaveImage / sim.saveImage

Description Saves an image to file or to memory. See also sim.loadImage, sim.getScaledImage and sim.getVisionSensorImg.
C/C++
synopsis
simSaveImage(const simUChar* image,const simInt* resolution,simInt options,const simChar* filename,simInt quality,simVoid* reserved)
C/C++
parameters
image: a pointer to rgb, rgba or greyscale values.
resolution: the x/y resolution of the provided image.
options: bit-coded. If bit0 and bit1 represent the format of the provided image (0=rgb, 1=rgba, 2=greyscale).
filename: the name of the file to write. The file extension indicates the format.
quality: the quality of the written image: 0 for best compression, 100 for largest file. Use -1 for default behaviour.
reserved: Reserved for future extension. Set to nullptr.
C/C++
return value
-1 if operation was not successful.
Lua
synopsis
buffer imgBuffer=sim.saveImage(buffer image,int[2] resolution,int options,string filename,int quality)
Lua
parameters
image: the image (in rgb, rgba or greyscale format)
resolution: the x/y resolution of the provided image.
options: bit-coded. If bit0 and bit1 represent the format of the provided image (0=rgb, 1=rgba, 2=greyscale).
filename: the name of the file to write. The file extension indicates the format. If the filename only contains '.xxx', where xxx represents the file format, then the image will be saved to memory
quality: the quality of the written image: 0 for best compression, 100 for largest file. Use -1 for default behaviour.
Lua
return values
imgBuffer: a buffer containing the image in packed format (e.g. png, jpg, etc.), if the image was specified to be saved to memory.
Python
synopsis
bytes imgBuffer=sim.saveImage(bytes image,list resolution,int options,string filename,int quality)

<