title: Cocos2d-x - encode base64 string from sprite or texture data
body: <p>How create base64 string from image data, encode base64 from image data,
  Ill try like this</p>
  
  <pre><code>CCRenderTexture* r = CCRenderTexture::create(sprite-&gt;getTexture()-&gt;getPixelsWide(), sprite-&gt;getTexture()-&gt;getPixelsHigh());
  r-&gt;beginWithClear(1, 1, 1, 0);
  sprite-&gt;visit();
  r-&gt;end();
  CCImage *img = r-&gt;newCCImage();
  unsigned char *data = img-&gt;getData();
  int len = img-&gt;getDataLen();
  str = base64_encode(data, len);
  
  
  return str;
  </code></pre>