<HTML><BODY>Hi all<br><br>This is my c++ code which I use to capture screen:<br>    Display* display = XOpenDisplay(NULL);<br>    Window root = DefaultRootWindow(display);<br>    XWindowAttributes attributes = {0};<br>    XGetWindowAttributes(display, root, &attributes);<br>    int width, height;<br>    width = attributes.width;<br>    height = attributes.height;<br>    XImage* img = XGetImage(display, root, 0, 0 , width, height, AllPlanes, ZPixmap);<br>    ...<br>    XDestroyImage(img);<br>    XCloseDisplay(display);<br><br>When I run it without Xvfb I get a normal screen picture. However, when I use it in Xvfb is not not normal. For example I tried to capture youtube in firefox as a result I see some green/blue image with you tube pieces.<br><br>This question was asked on stackoverflow <a href="http://stackoverflow.com/questions/42110050/xlib-and-xvfb-capture-screen" data-mce-href="http://stackoverflow.com/questions/42110050/xlib-and-xvfb-capture-screen">http://stackoverflow.com/questions/42110050/xlib-and-xvfb-capture-screen</a> <br>and there can be seen the result image.<br><br>How to fix it?<br><br><br>-- <br>Alex Sviridov</BODY></HTML>