Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Here is a vid demonstrating the issue.

Whenever I try and grab a screenshot, I grab a different picture to what I think I am grabbing (except when using ubuntu's printscreen functionality when you hit the key). This issue is not specifically tied to shutter (from the video), but my own screenshot program written in python demonstrates the same behaviour. A sample of the code that takes the screenshot is here:

def grab_screenshot():
    """ Grabs a screenshot of the active window and saves it as a png with the current time """
    root = gtk.gdk.screen_get_default()

    if root.supports_net_wm_hint("_NET_ACTIVE_WINDOW") and root.supports_net_wm_hint("_NET_WM_WINDOW_TYPE"):
        print "Grabbing active window"
        active = root.get_active_window()

        # Comment these two lines if you dont want to enable screenshotting of the entire desktop
        # instead of just the active window.
#        if active.property_get("_NET_WM_WINDOW_TYPE")[-1][0] == '_NET_WM_WINDOW_TYPE_DESKTOP':
#            return "FAIL"

        # Calculate the size of the wm decorations
        relativex, relativey, winw, winh, d = active.get_geometry() 
        w = winw + (relativex*2)
        h = winh + (relativey+relativex)

        # Calculate the position of where the wm decorations start (not the window itself)
        screenposx, screenposy = active.get_root_origin()
        print "screen posx: %d" % screenposx
        print "screen posy: %d" % screenposy

        # Take the screenshot
        screenshot = gtk.gdk.Pixbuf.get_from_drawable(gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, True, 8, w, h),
                                                      screenposx, screenposy, 0, 0, w, h)
        window = gtk.gdk.get_default_root_window()
        size = window.get_size()
        print "The size of the window is %d x %d" % size
        pixel_buffer = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, False, 8, size[0], size[1])
        screenshot = pixel_buffer.get_from_drawable(window, window.get_colormap(), 0, 0, 0, 0, size[0], size[1])

    if (screenshot != None):
        timeNow = time.time()
        fileName = "screenshot_%d.png" %timeNow, "png")

        print "Screenshot saved to " + fileName
        print "Unable to get the screenshot."
        fileName = "FAIL"

    return fileName

I am guessing this is an issue with the gtk? I tried ticking the gtk loader utility in compiz, but that doesn't seem to have helped in any way.

share|improve this question
Can you provide more info on your own screenshot program? – don.joey Jun 26 '13 at 13:13
I linked the entire grabscreenshot function in python. Everything is handled from within that function. I am hoping that will suffice. – Programster Jun 26 '13 at 17:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.