ofSaveImage using ofBuffer

I see that in ofImage there are two options for saving images:

saveImage(ofPixels_<PixelType> & pix, string fileName, ofImageQualityType qualityLevel) {


saveImage(ofPixels_<PixelType> & pix, ofBuffer & buffer, ofImageFormat format, ofImageQualityType qualityLevel);

I’m trying to understand the second case. Why ofBuffer?

you can save an image to a buffer to get the compressed version in memory, could be useful to send it over the network or save it later using ofFile…

I see… so it doesn’t create any file. it is like one step before that