2009-11-26 15:34:16 +0000 2009-11-26 15:34:16 +0000
51
51
Advertisement

Windowsでコマンドラインからスクリーンショットを撮る

Advertisement

コマンドラインから画面全体のスクリーンショットを撮る方法を探しています。OSはWindowsです。こんな感じのものです。

C:\>screenshot.exe screen1.png
Advertisement
Advertisement

回答 (8)

41
41
41
2009-11-28 15:51:24 +0000

この質問は既に回答されていますが、私はこれも投げてみようと思いました。 NirCmd (フリーウェアですが、悲しいかな、オープンソースではありません)は、コマンドラインからスクリーンショットを撮ることができます。

nircmd.exeのディレクトリ、またはsystem32フォルダにコピーした場合、コマンドラインからこれを実行します。

nircmd.exe savescreenshot screen1.png

を実行すると、お望み通りになります。このように遅延させることもできます。

nircmd.exe cmdwait 2000 savescreenshot screen1.png

これで2000ミリ秒(2秒)待ち、スクリーンショットをキャプチャして保存します。

26
26
26
2009-11-26 16:16:13 +0000

ダウンロード imagemagick . 多くのコマンドライン画像操作ツールが含まれています。import ](http://www.imagemagick.org/script/import.php)では、画面の一部または全部をキャプチャしてファイルに保存することができます。例えば、画面全体をjpegとして保存するには、

import -window root screen.jpeg

マウスを使ってウィンドウ内をクリックしたり、画面領域を選択してpngとして保存したい場合は、次のようにします。

import box.png
``` 0x1&
18
Advertisement
18
18
2015-07-22 16:09:30 +0000
Advertisement

これは外部ツールなしで行うことができます(インストールされた.netフレームワークが必要なだけで、Vista以上のすべてのものにデフォルトでインストールされています) - screenCapture.bat . これはセルフコンパイルされたC#プログラムで、出力をいくつかの形式で保存したり、アクティブなウィンドウのみをキャプチャしたり、画面全体をキャプチャしたりすることができます。

screenCapture- captures the screen or the active window and saves it to a file
Usage:
screenCapture filename.format [WindowTitle]

filename - the file where the screen capture will be saved
format - Bmp,Emf,Exif,Gif,Icon,Jpeg,Png,Tiff and are supported - default is bmp
WindowTitle - instead of capturing the whole screen will capture the only a window with the given title if there's such

例。

call screenCapture notepad.jpg "Notepad"
call screenCapture screen.png

の例

10
10
10
2012-02-03 08:45:07 +0000

IrfanView](http://www.irfanview.com/)を試してみてください。

コマンドラインから実行できます。キャプチャするウィンドウを指定することができます(ウィンドウ全体、または現在/アクティブなウィンドウのみなど)。

ここに コマンドラインオプション がありますが、特に興味深いのは

i_view32 /capture=0 /convert=wholescreen.png
``` です。
6
Advertisement
6
6
2011-07-11 18:05:16 +0000
Advertisement

Screenshot-cmd ](http://code.google.com/p/screenshot-cmd/)は、デスクトップやウィンドウタイトルで選択されたウィンドウのスクリーンショットを撮影します。キャプチャする矩形を選択することも可能です。キャプチャ結果はpngファイルとして保存されます。(最終更新は2011年)

OPTIONS: -wt WINDOW\_TITLE Select window with this title. Title must not contain space (" "). -wh WINDOW\_HANDLE Select window by it's handle (representad as hex string - f.e. "0012079E") -rc LEFT TOP RIGHT BOTTOM Crop source. If no WINDOW\_TITLE is provided (0,0) is left top corner of desktop, else if WINDOW\_TITLE maches a desktop window (0,0) is it's top left corner. -o FILENAME Output file name, if none, the image will be saved as "screenshot.png" in the current working directory. -h Shows this help info.

インスパイアされています。 http://blog.mozilla.com/ted/2009/02/05/command-line-screenshot-tool-for-windows/

6
6
6
2009-11-26 15:42:42 +0000

boxcutter ](http://keepnote.org/boxcutter/)ツールを試してみてください。

usage: boxcutter [OPTIONS] [OUTPUT_FILENAME]

Saves a bitmap screenshot to 'OUTPUT_FILENAME' if given. Otherwise, 
screenshot is stored on clipboard by default.

OPTIONS
  -c, --coords X1,Y1,X2,Y2 capture the rectange (X1,Y1)-(X2,Y2)
  -f, --fullscreen fullscreen screenshot
  -v, --version display version information
  -h, --help display help message
2
Advertisement
2
2
2018-02-02 04:01:04 +0000
Advertisement

Pillow pythonライブラリを使って、プライマリモニタ

Step1: Pillowをインストールします。

pip install -user pillow

Step2: 以下のコードでスクリーンショットを撮影します。

from PIL import ImageGrab
img = ImageGrab.grab()
img.save('screenshot.bmp')

Step2: 以下のコードでスクリーンショットを撮る

1
1
1
2009-11-27 14:44:11 +0000

市販の snapit を使えば、コマンドラインから素晴らしいスクリーンショットを撮ることができます。

Advertisement

関連する質問

3
19
10
28
3
Advertisement
Advertisement