When you take screenshots you want to be able to control the window size because of at least two reasons:
When it comes to taking screenshots of webpages, all you have to do is to go to the webpage of interest and invoke the magic javascript:self.resizeTo(800,600)
incantation from the address bar to set the browser size to 800/600. This works both on Mac and on Windows (did not test on Unix/Linux), but in some browsers (like Safari 4.0) it will only work if there is only one tab open.
But it’s not just the web browsers we want to take screenshots of. So, what to do when you have a regular window?
On Mac, the easiest answer is to use an AppleScript like:
tell application "Script Editor" to set the bounds of the front window to {0, 0, 800, 600}
The script looks for the application named "Safari" and then resizes the front window. It actually also moves the window origin but if desired that can easily be fixed with more scripting. To execute the script, just load it in the Script Editor (located in /Applications/AppleScript), and run it.
If you prefer to execute it from the command line, all you have to do is to run it using the /usr/bin/osascript. To do that you can create a script file that contains:
#!/usr/bin/osascript tell application "Script Editor" to set the bounds of the front window to {0, 0, 800, 600}
For those that are not in the mood of executing scripts, I also prepared a simple resize-window.app.zip that will ask for the name of the application and the desired dimensions.
This is my solution on Mac, but I do not know how to do something similar on Windows or Linux. Do you?