Load png image from base64 string


I would like to embed images in my OF exe by using the embeded base64 method.
Does ofImage can load and display an image from a png encoded as base64 ?
I have have eared about ofBuffer but i can’t find any working exemple.

Thanks a lot again !


//from loveandsheep/ofxKsmrFragmentFx/example

ofImage image;
#include "ofApp.h"

#include "Poco/Base64Decoder.h"
#include "sheepImage.h"

void ofApp::setup(){
	stringstream ss;
    //merge parts
	ss << sheepImage1 << sheepImage2 << sheepImage3 << sheepImage4 << sheepImage5 << sheepImage6;
	Poco::Base64Decoder b64in(ss);

	ofBuffer buffer;
	b64in >> buffer;


void ofApp::draw(){

	image.draw(0, 0);

Thanks a lot @moebiussurfing , it works perfectly !!!

cool. what do you used to encode the images to string?

I can make it work by setting string sheepImage1 to static string sheepImage1

  • Using M2 Mac
  • oF Nightly Build: of_v20230728_osx_release