Can't screenshot plugin UIs


createComponentSnapshot gives a completely white (for AUs) or completely black (for VSTs) image when the component is the editor of a plugin (e.g. a VSTPluginWindow). Why can they be drawn to the screen but not to an image, and does anyone know a way around this?


this is on macOS, btw. Maybe it has to do with security, you can’t access the pixels that you don’t “own”?


It’s a bit tricker as the windows aren’t JUCE component, they’re native windows. You need to use createSnapshotOfNativeWindow and pass it the native window handle (ComponentPeer::getNativeHandle()).

You’ll have to account for any window borders or scaling yourself and that depends on the platform.


Thanks dave! However createSnapshotOfNativeWindow doesn’t seem to be exposed? How can I call it without hacking into the JUCE source code (which I’d rather not do for obvious reasons)?


Just forward declare it:

namespace juce
    Image createSnapshotOfNativeWindow (void* nativeWindowHandle);


aaaahhh thanks… I tried that but I forgot the namespace. It works, cheers!