tags:

views:

606

answers:

3

Hi,

Like the title says, I want to take a screenshot of a window application running under wine. Not the entire desktop. C would be preferred but could also use java or Pascal.

Thanks in advance

+1  A: 

Use imagemagick's import command to grab the window and dump it to a file...

import documentation

Wrap the call in a C system command

 system("import -window (your window name) capture.png").

Then you can access the image from the file using any of the standard image loading libraries.

justinhj
+1  A: 

A possible way with the Linux shell:

  • use xwininfo to find the window id we're looking for
  • use import to dump a screenshot
  • (read man import and man xwininfo for more information)

Example with wine:

import -window `xwininfo -root -children | grep "Wine" | awk '{print $1}'` outfile.pcx
ChristopheD
A: 

You could duplicate the functionality of ImageMagick's import command using MagickWand (C API) or Magick++ (C++ API), but calling import directly via system() as suggested by justinhj is likely the simplest approach if you don't mind distributing import with your software.

Sparr