Page 1 of 1

How to create a screenshot of the currently active window ?

Posted: 2013-12-28T14:56:13-07:00
by aaron_caffrey
Hello everyone,

In imagemagick there is a command ( import -frame -window ) where I can specify which is the active window and create a screenshot, but I am unable to find any article about that for magick++.

Can you help me ?

Re: How to create a screenshot of the currently active windo

Posted: 2013-12-28T18:08:43-07:00
by magick
Use the x: coder with a X window ID. For example, xwininfo reports a windows ID of 0x240003d. Use read("x: 0x240003d") in Magick++. To test, try
  • convert x:0x240003d x:

Re: How to create a screenshot of the currently active windo

Posted: 2013-12-29T00:34:45-07:00
by aaron_caffrey
magick wrote:Use the x: coder with a X window ID. For example, xwininfo reports a windows ID of 0x240003d. Use read("x: 0x240003d") in Magick++. To test, try
  • convert x:0x240003d x:
Awesome, thank you so much ! Happy New Year :)

Re: How to create a screenshot of the currently active windo

Posted: 2014-04-23T00:51:42-07:00
by Dzhoko
How can I create a screenshot of active window in windows 7 ? I can't find a "x window Id", xwininfo is just for Linux.

Re: How to create a screenshot of the currently active windo

Posted: 2014-04-23T02:34:46-07:00
by dlemstra
Under Windows you need should use the following file name: 'screenshot:' (This requires the latest version of ImageMagick). And if your computer has multiple monitors you can specify an index 'screenshot:[1]'.

Re: How to create a screenshot of the currently active windo

Posted: 2014-04-23T04:55:20-07:00
by Dzhoko
I have tried,

...
Image screen("screenshot:"); It's work.
...


but if I save the screen
....
screen.write("screen.jpg"); I become a error
...

how can i save a screenshot?

Re: How to create a screenshot of the currently active window ?

Posted: 2018-02-01T13:04:47-07:00
by alpha_lsdljf
Hi all

I am also trying to use `imagemagick` to capture the primary screen on my multi-monitor setup in _Windows10_

Did anybody try the

`convert 'screenshot:[1]` option that @dlemstra mentioned above?

Re: How to create a screenshot of the currently active window ?

Posted: 2018-02-01T13:22:36-07:00
by snibgo
Yes, on Windows 8.1. It works. For my laptop, with a second screen, to capture them both:

Code: Select all

convert screenshot:[0] main.png

Code: Select all

convert screenshot:[1] second.png