Can not load image file

Hello Guys,
Actually i am developing audio plugins with JUCE. Before i used ubuntu platform. I just start to work with Windows10 platform. So, i am using same plugins which developed with Ubuntu.
So, my current issue is that i can not load image file which i already tested with ubuntu system.
So, what should be reason behind this?

What does the debugger say?

Hello Rory,
I have not used visual studio before. So, how can i check what you said?

You can start by learning how the debugger works. If you have used a debugger before, it won’t take long to get your head around it. If you have not used a debugger before, spend some time learning how to use one. You won’t get far as a programmer without it.

Also, if you have an issue, you should post any relevant code, there is not a whole lot people here can do for you otherwise but speculate.

So, In parallel, i show you lines of code which i used to load image file.

/Declared in PluginEditor.h file(private)/
juce::Image logo;
juce::ImageComponent imageComponent;

/*Define in constructor of file “PluginEditor.cpp” */
juce::File imagefile(“E:/Projects/VST_Plugins/logo.png”);

logo = juce::ImageFileFormat::loadFrom(imagefile);

if (logo.isValid())
    imageComponent.setImage(logo.rescaled(WIDTH - (WIDTH/3) - 2, HEIGHT - (HEIGHT/3) - 2, juce::Graphics::highResamplingQuality));

imageComponent.setBounds(waveformBoxStartX + 1, waveformBoxStartY + 1, WIDTH - (WIDTH/3) - 2, HEIGHT - (HEIGHT/3) - 2);

I’d start by placing a breakpoint within the if(logo....) block to see if it gets hit. If not, then find out why your image is not valid, a path issue maybe?

Thanks Rory,
I will update you after debugging.

A side note: to make your code more readable here on the forum, while you’re editing your post you should select the code portion and format it using the button that has this icon: “</>” on it.

The same is obtained by adding four spaces before every line in your code (that’s the reason why a portion of your code above displays properly) or by adding three backticks ``` before and after your code section

1 Like

Hello Rory,
This is like as AtmelStudio IDE, i thought something else to debug.
So, i used breakpoint, and if condition has true when debugging.

It’s kind of hard to say what’s wrong here. Perhaps it is not being placed where you want, are those position variables correct? Maybe you could put a breakpoint in the ImageComponent::draw() method to see if that is being called?

Hello Rory,
Now, image can load. I just clean and build Project.


1 Like