SHOW:
|
|
- or go back to the newest paste.
| 1 | [Reflection.Assembly]::LoadWithPartialName("System.Drawing")
| |
| 2 | function screenshot([Drawing.Rectangle]$bounds, $path) {
| |
| 3 | $bmp = New-Object Drawing.Bitmap $bounds.width, $bounds.height | |
| 4 | $graphics = [Drawing.Graphics]::FromImage($bmp) | |
| 5 | ||
| 6 | $graphics.CopyFromScreen($bounds.Location, [Drawing.Point]::Empty, $bounds.size) | |
| 7 | ||
| 8 | $bmp.Save($path) | |
| 9 | ||
| 10 | $graphics.Dispose() | |
| 11 | $bmp.Dispose() | |
| 12 | } | |
| 13 | ||
| 14 | $bounds = [Drawing.Rectangle]::FromLTRB(0, 0, 1000, 900) | |
| 15 | screenshot $bounds "C:\screenshot.png" |