Regular API function

simSaveImage / sim.saveImage

Description Saves an image to file or to memory. See also sim.loadImage, sim.getScaledImage and sim.getVisionSensorCharImage.
C synopsis simSaveImage(const simUChar* image,const simInt* resolution,simInt options,const simChar* filename,simInt quality,simVoid* reserved)
C parameters
image: a pointer to rgb or rgba values.
resolution: the x/y resolution of the provided image.
options: bit-coded. If bit0 is set (1), then the provided image is rgba, otherwise it is rgb.
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 NULL.
C return value
-1 if operation was not successful.
Lua synopsis
1) number result=sim.saveImage(string image,table_2 resolution,number options,string filename,number quality)
2) string imgBuffer=sim.saveImage(string image,table_2 resolution,number options,string filename,number quality)
Lua parameters
image: a pointer to rgb or rgba values.
resolution: the x/y resolution of the provided image.
options: bit-coded. If bit0 is set (1), then the provided image is rgba, otherwise it is rgb.
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
1) result: -1 if operation was not successful
2) imgBuffer: a buffer containing the image in packed format (e.g. png, jpg, etc.)

All regular API functions on one page