Regular API function

simLoadImage / sim.loadImage

Description Loads an image from file or memory. See also sim.saveImage, sim.getScaledImage, sim.transformImage and sim.setVisionSensorImg.
C/C++
synopsis
simUChar* simLoadImage(simInt* resolution,simInt options,const simChar* filenameOrBuffer,simVoid* reserved)
C/C++
parameters
resolution: a pointer that will accept the image resolution.
options: bit-coded. If bit0 is set (1), then the returned image is rgba, otherwise it is rgb.
filename: the name of the file to read. The file extension indicates the format. If you wish to load an image from a memory buffer, then have filename point to that memory buffer.
reserved: Set to nullptr if you load an image from file. If you load an image from a memory buffer, this should be to an integer pointer where the first pointed integer is the size of the memory buffer.
C/C++
return value
nullptr if operation was not successful, otherwise a buffer containing the image data. The user is in charge of releasing the buffer with simReleaseBuffer.
Lua
synopsis
buffer image,int[2] resolution=sim.loadImage(int options,string/buffer filenameOrBuffer)
Lua
parameters
Similar to the C-function counterpart. To load an image from a string buffer, simply prefix the buffer with "@mem".
Lua
return values
Similar to the C-function counterpart
Python
synopsis
bytes image,list resolution=sim.loadImage(int options,string/bytes filenameOrBuffer)