Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Is it possible to get a screenshot of the entire desktop directly in Mathematica?

I am on Ubuntu running Mathematica 8. For some reason GUIScreenShot[] fails. But something like GUIScreenShot[{{0, 500}, {0, 500}}] works

It is strange that in the reference

GUIScreenShot[]

is given as an example (last one), with the caption Capture the entire screen:. But when I copy it and paste it in a notebook, it expects a parameter! (I have included the code Needs["GUIKit`"])

I get the error as shown in this image

Screenshot of the image

share|improve this question
1  
I am trying to automate a simple game (!). So grabbing it using an external program, then saving it as a file and importing the file again from within Mathematica is a tedious job (if not realtime). Also I am not sure if I can pipe the output of a program as input to Mathematica (I could not find a way to get it done with Run[] command! - i.e. the piping large output from external program) –  my account_ram Aug 11 '12 at 23:16
    
GUIScreenShot[] works here (Win XP) –  belisarius Aug 11 '12 at 23:34
    
GUIScreenShot[] doesn't work for me (Arch Linux), it spits this error message on the terminal. Looks like a Linux issue... –  Renan Aug 12 '12 at 0:14
    
It works fine on my win7_x64 and mma8.0.4 (although a syntax indicator). Didn't know this function before. Very helpful! Thanks and +1! –  Silvia Aug 12 '12 at 6:52
    
GUIScreenShot[] works in version 7 under Windows 7. –  Mr.Wizard Aug 12 '12 at 7:55
show 1 more comment

2 Answers

GUIScreenShot[] (without arguments) works perfectly fine on my Mac, although the front end syntax highlighter indicates a missing argument. As a workaround, you can explicitly give it the dimensions of your screen so that all of it is captured. Here's how you can programmatically get your screen size and use it:

Needs["GUIKit`"]
GUIScreenShot["FullScreenArea" /. Flatten@SystemInformation["Devices", "ScreenInformation"]]
share|improve this answer
1  
This does not seem to work on Ubuntu .. Can any1 confirm this ... –  my account_ram Aug 12 '12 at 0:58
    
@myaccount_ram I'm having the same problem, but with Arch Linux. –  Renan Aug 12 '12 at 4:00
    
@myaccount_ram It doesn't work on Fedora. –  b.gatessucks Aug 12 '12 at 7:34
    
I got ** Raster data contains 0 values per pixel; 3 or 4 are required with ColorFunction->RGBColor** under Linux 64. –  Fred Kline Aug 12 '12 at 20:39
1  
@everyone: The issue seems to be something related to linux and not Mathematica. I would've helped if I could, but I don't have a license to use on my Linux machine. –  rm -rf Aug 13 '12 at 1:53
show 1 more comment

Confirming @R.M's answer (WinXP, Mac OSX 10.8)

enter image description here

share|improve this answer
1  
why not a comment? Also, why are you hiding your porn tabs? ;) –  rm -rf Aug 11 '12 at 23:44
    
@rm -rf The porn tabs are there ... look again –  belisarius Aug 11 '12 at 23:45
1  
@belisarius Nest[GUIScreenShot[], "", 10] –  s0rce Aug 12 '12 at 3:29
1  
@belisarius It's not a Droste effect until it is. –  rm -rf Aug 12 '12 at 11:57
1  
The Droste Effect: Dynamic[Export["C:\\droste.png", GUIScreenShot[]]; Style[GUIScreenShot[], Magnification -> 1], UpdateInterval -> 3]. When the Dynamic object is not visible, it is not updated (it is sufficient just to reduce the Mathematica window). –  Alexey Popkov Aug 12 '12 at 18:33
show 2 more comments

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.