Get screenshot of a plugin without open it

I write this code to test the functionality:

if (const auto& peer = processorEditor->getPeer())
                cachedImage = new juce::Image { createSnapshotOfNativeWindow(peer-> getNativeHandle ())

My question is there is a way to get the snapshot of plugin without open the window on screen ?

Did you try using Component::createComponentSnapshot() instead? If I recall correctly you don’t need to actually show it for that to work.

I don’t believe there’s a way to do this. VST3 has a feature where images/thumbnails of the plugin can be distributed inside the VST3 bundle, but many plugins don’t make use of this feature, and we don’t surface the feature in JUCE currently. I don’t know of similar functionality in other plugin formats.

createComponentSnapshot() will only take Component graphics into account. It doesn’t handle nested native windows such as plugin editors.

2 Likes

Ok, so my only way is to launch the editor at creation of plugin if the folder where I save my images doesn’t has it and then close it quick

Sounds like a feature that pluginval could provide.

It already does plugin instantiation and parameter randomization - seems like a logical next step to add “save screenshots during tests” …