(Background) Image not shown at all

Hi everybody, i've been trying to include a  background image in an audio plugin,

but it isn't shown at all ...

I've included the image (tried bmp and png so far) as BinaryData using IntroJucer. It worked.

I've declared the image in PluginEditor.h and initialized it in PluginEditor.cpp (in the same way i initialized sliders, ect, in the constructor):

backgroundImage(ImageCache::getFromMemory(BinaryData::bmp00129_bmp, BinaryData::bmp00129_bmpSize)),

Now, in the paint() method, i called:

 g.drawImageAt(backgroundImage, 0, 0, true);

(also tried 'false' for the boolean flag).

Everything compiles fine, there are no problems when i load the plugin in the plugin host, BUT ... there's no image ... sliders and everything is shown ...

Any idea?



Do other things within paint() draws correctly?

Try drawing just the background without any other visual elements. does it work?

No, if i only try to draw the image, there’s just a black field …

Are you enabling OpenGL context?

No, should i ?

a) you can check with a breakpoint of your debugger, if the backgroundImage has a size of non zero. So you can check if the loading worked

b) comment everything else in the paint method so there is only the image drawn, maybe something later in your code covers everything in black?

c) remove all children: comment all addAndMakeVisible calls in the constructor, they can overpaint too

d) Check that you didn't instanciate your own Graphics instance, only use the one you get as argument from paint(Graphics* g);

Do you hide the "g" unintentionally? similar to:

void Component::paint (Graphics& g)


if (true) {

Graphics g;

g.drawImageAt( backgroundImage, 0, 0, true);



then drawImageAt doesnt reach the graphics context...

Good luck


a) Is there some Tutorial on how to use a debugger for audio plugins ? But anyway, manual debug output is fine ! The image is included as BinaryData, anyway, and the BinaryData isn’t empty !

b) Did that, to no avail …

c) Did that, to no avail …

d) “g” is not hidden !

Would it help to use an ImageComponent or something ?

Ok, i just found out that


 ImageCache::getFromMemory(BinaryData::bmp00129_bmp, BinaryData::bmp00129_bmpSize)

returns an invalid image, though the BinaryData itself is populated correctly ... any ideas why ?

You know that there's no cross-platform .bmp parser in juce? On OSX the system's image loader may handle it, but I wouldn't count on it.

(And surely you'd want to use pngs instead for your embedded images, which are lossless and smaller than bmps!)

you do it rad, take my bad code, and make it better !!


Yes, that was the problem ... with png, the background image is displayed perfectly !


Thanks !