Help adding images/binary data

Hi, I want to add resources to Juce.
I added a new group called Resources. Then add ‘existing file’ and select my .png file. It then adds it with ‘Binary Resource’ ticked.
When I save and load it into my IDE (VS) it appears as a png file rather than a text file. Am I doing anything wrong? I thought we’re supposed to make separate files out of our resources.

Not sure what your issue is, if you add a .png file wouldn’t you expect it to be a .png file?

If you want the file as a char array, the Projucer adds a pair of files named BinaryData.h and BinaryData.cpp under the /JuceLibraryCode/ directory. The binary data can be accessed as a char array like this:

#include "../JuceLibraryCode/JuceHeader.h"

const char* data = BinaryData::filename_extension;
const int dataSize = BinaryData::filename_extension_size;

Use BinaryBuilder in the extras folder to generate the BinaryData files.


That’s where I was getting confused, because now you can just add them into your Projucer project and they will be saved for you. Thanks Holy_City for showing me the way. So is this the best way to store png files then? I have quite a lot of images to use.