ofImage -> ofBuffer

Apologies if this isn’t quite the right spot in the forums for this. Feel like it lands under a few categories.

I’m trying to wrap my head around ofBuffers and converting char * to strings - working towards a simple encryption addon that would allow for base64 encoding of binary data. As a simple example of this I’m trying to get the contents of an ofImage into an ofBuffer.

I’ve created a super simple gist for my ultra-simplistic approach but the ofBuffer does not appear to fill up.


So I suppose I have two questions:

  1. Am I seeing a bug in ofImage::saveImage(ofBuffer &buffer) that basically isn’t actually saving the ofBuffer?


  1. In writing the addon should I accept char * instead of ofBuffer for what I’m going to encode? Seems I could get to the bytes I’d want either way (getBinaryBuffer()) but I wanted it to be consistant with oF’s API.

Answered my own question!

Check out https://github.com/jkosoy/ofxCrypto for what I was doing with this. I’ll update the gist for posterity’s sake.