spx2 has asked for the wisdom of the Perl Monks concerning the following question:

Win32::Screenshot doesn't build because Image::Magick doesn't build. I also tried Win32::Capture which doesn't build. This is all on Strawberry Perl on Windows. Any ideas on any working module that does this under Windows ? Thanks
Magick.xs: In function `XS_Image__Magick_QueryFont': Magick.xs:11471: error: `MaxTextExtent' undeclared (first use in this function) Magick.xs:11474: error: `ExceptionInfo' undeclared (first use in this function) Magick.xs:11474: error: `exception' undeclared (first use in this function) Magick.xs:11483: error: syntax error before '*' token Magick.xs:11490: error: syntax error before '*' token Magick.xs:11495: error: `typelist' undeclared (first use in this function) Magick.xs:11501: error: syntax error before "TypeInfo" Magick.xs:11509: error: `type_info' undeclared (first use in this function) Magick.xs:11510: error: `TypeInfo' undeclared (first use in this function) Magick.xs:11510: error: syntax error before ')' token Magick.xs:11527: error: `UndefinedStyle' undeclared (first use in this function) Magick.xs:11530: warning: passing arg 2 of `Perl_newSVpv' makes pointer from int eger without a cast Magick.xs:11532: error: `UndefinedStretch' undeclared (first use in this functio n) Magick.xs:11535: warning: passing arg 2 of `Perl_newSVpv' makes pointer from int eger without a cast Magick.xs:11562: error: `UndefinedException' undeclared (first use in this funct ion) Magick.xs: In function `XS_Image__Magick_QueryFontMetrics': Magick.xs:11587: error: `AffineMatrix' undeclared (first use in this function) Magick.xs:11587: error: syntax error before "affine" Magick.xs:11601: error: `DrawInfo' undeclared (first use in this function) Magick.xs:11601: error: `draw_info' undeclared (first use in this function) Magick.xs:11604: error: `ExceptionInfo' undeclared (first use in this function) Magick.xs:11604: error: `exception' undeclared (first use in this function) Magick.xs:11607: error: `GeometryInfo' undeclared (first use in this function) Magick.xs:11607: error: syntax error before "geometry_info" Magick.xs:11610: error: `Image' undeclared (first use in this function) Magick.xs:11610: error: `image' undeclared (first use in this function) Magick.xs:11616: error: `MagickBooleanType' undeclared (first use in this functi on) Magick.xs:11616: error: syntax error before "status" Magick.xs:11619: error: `MagickStatusType' undeclared (first use in this functio n) Magick.xs:11633: error: `TypeMetric' undeclared (first use in this function) Magick.xs:11633: error: syntax error before "metrics" Magick.xs:11643: error: syntax error before ')' token Magick.xs:11645: error: `OptionError' undeclared (first use in this function) Magick.xs:11650: error: dereferencing pointer to incomplete type Magick.xs:11650: error: syntax error before ')' token Magick.xs:11652: error: `current' undeclared (first use in this function) Magick.xs:11653: error: `affine' undeclared (first use in this function) Magick.xs:11667: error: `MagickFalse' undeclared (first use in this function) Magick.xs:11675: error: `MagickTrue' undeclared (first use in this function) Magick.xs:11740: error: `GravityType' undeclared (first use in this function) Magick.xs:11740: error: syntax error before "ParseMagickOption" Magick.xs:11753: error: `flags' undeclared (first use in this function) Magick.xs:11753: error: `geometry_info' undeclared (first use in this function) Magick.xs:11801: error: `SigmaValue' undeclared (first use in this function) Magick.xs:11853: error: `StyleType' undeclared (first use in this function) Magick.xs:11853: error: syntax error before "type" Magick.xs:11937: error: `MaxTextExtent' undeclared (first use in this function) Magick.xs:11940: error: `status' undeclared (first use in this function) Magick.xs:11940: error: `metrics' undeclared (first use in this function) Magick.xs:11965: error: `UndefinedException' undeclared (first use in this funct ion) Magick.xs: In function `XS_Image__Magick_QueryMultilineFontMetrics': Magick.xs:11990: error: `AffineMatrix' undeclared (first use in this function) Magick.xs:11990: error: syntax error before "affine" Magick.xs:12004: error: `DrawInfo' undeclared (first use in this function) Magick.xs:12004: error: `draw_info' undeclared (first use in this function) Magick.xs:12007: error: `ExceptionInfo' undeclared (first use in this function) Magick.xs:12007: error: `exception' undeclared (first use in this function) Magick.xs:12010: error: `GeometryInfo' undeclared (first use in this function) Magick.xs:12010: error: syntax error before "geometry_info" Magick.xs:12013: error: `Image' undeclared (first use in this function) Magick.xs:12013: error: `image' undeclared (first use in this function) Magick.xs:12019: error: `MagickBooleanType' undeclared (first use in this functi on) Magick.xs:12019: error: syntax error before "status" Magick.xs:12022: error: `MagickStatusType' undeclared (first use in this functio n) Magick.xs:12036: error: `TypeMetric' undeclared (first use in this function) Magick.xs:12036: error: syntax error before "metrics" Magick.xs:12046: error: syntax error before ')' token Magick.xs:12048: error: `OptionError' undeclared (first use in this function) Magick.xs:12053: error: dereferencing pointer to incomplete type Magick.xs:12053: error: syntax error before ')' token Magick.xs:12055: error: `current' undeclared (first use in this function) Magick.xs:12056: error: `affine' undeclared (first use in this function) Magick.xs:12070: error: `MagickFalse' undeclared (first use in this function) Magick.xs:12078: error: `MagickTrue' undeclared (first use in this function) Magick.xs:12143: error: `GravityType' undeclared (first use in this function) Magick.xs:12143: error: syntax error before "ParseMagickOption" Magick.xs:12156: error: `flags' undeclared (first use in this function) Magick.xs:12156: error: `geometry_info' undeclared (first use in this function) Magick.xs:12172: error: `SigmaValue' undeclared (first use in this function) Magick.xs:12224: error: `StyleType' undeclared (first use in this function) Magick.xs:12224: error: syntax error before "type" Magick.xs:12308: error: `MaxTextExtent' undeclared (first use in this function) Magick.xs:12311: error: `status' undeclared (first use in this function) Magick.xs:12311: error: `metrics' undeclared (first use in this function) Magick.xs:12336: error: `UndefinedException' undeclared (first use in this funct ion) Magick.xs: In function `XS_Image__Magick_QueryFormat': Magick.xs:12364: error: `ExceptionInfo' undeclared (first use in this function) Magick.xs:12364: error: `exception' undeclared (first use in this function) Magick.xs:12373: error: syntax error before '*' token Magick.xs:12380: error: `MaxTextExtent' undeclared (first use in this function) Magick.xs:12383: error: syntax error before '*' token Magick.xs:12388: error: `format_list' undeclared (first use in this function) Magick.xs:12396: error: syntax error before "MagickInfo" Magick.xs:12404: error: `magick_info' undeclared (first use in this function) Magick.xs:12405: error: syntax error before "MagickInfo" Magick.xs:12426: error: `UndefinedException' undeclared (first use in this funct ion) Magick.xs: In function `XS_Image__Magick_QueryOption': Magick.xs:12454: error: `ExceptionInfo' undeclared (first use in this function) Magick.xs:12454: error: `exception' undeclared (first use in this function) Magick.xs:12471: error: `MagickListOptions' undeclared (first use in this functi on) Magick.xs:12471: error: `MagickFalse' undeclared (first use in this function) Magick.xs:12473: error: `MagickOption' undeclared (first use in this function) Magick.xs:12473: error: syntax error before "option" Magick.xs:12480: warning: assignment makes pointer from integer without a cast Magick.xs:12485: error: `MaxTextExtent' undeclared (first use in this function) Magick.xs:12485: error: `UndefinedException' undeclared (first use in this funct ion) Magick.xs: In function `XS_Image__Magick_Read': Magick.xs:12519: error: `ExceptionInfo' undeclared (first use in this function) Magick.xs:12519: error: `exception' undeclared (first use in this function) Magick.xs:12525: error: `Image' undeclared (first use in this function) Magick.xs:12525: error: `image' undeclared (first use in this function) Magick.xs:12535: error: `MagickBooleanType' undeclared (first use in this functi on) Magick.xs:12535: error: syntax error before "status" Magick.xs:12566: error: `ResourceLimitError' undeclared (first use in this funct ion) Magick.xs:12579: error: `OptionError' undeclared (first use in this function) Magick.xs:12597: error: dereferencing pointer to incomplete type Magick.xs:12598: error: dereferencing pointer to incomplete type Magick.xs:12610: error: dereferencing pointer to incomplete type Magick.xs:12626: error: `BlobError' undeclared (first use in this function) Magick.xs:12637: error: dereferencing pointer to incomplete type Magick.xs:12645: error: `status' undeclared (first use in this function) Magick.xs:12646: error: `MagickFalse' undeclared (first use in this function) Magick.xs:12655: error: dereferencing pointer to incomplete type Magick.xs:12656: error: dereferencing pointer to incomplete type Magick.xs:12658: error: dereferencing pointer to incomplete type Magick.xs:12659: error: syntax error before ')' token Magick.xs:12664: error: dereferencing pointer to incomplete type Magick.xs:12665: error: `MaxTextExtent' undeclared (first use in this function) Magick.xs:12666: error: dereferencing pointer to incomplete type Magick.xs:12668: error: syntax error before ')' token Magick.xs:12668: error: `ErrorException' undeclared (first use in this function) Magick.xs:12672: error: syntax error before ')' token Magick.xs:12700: error: `UndefinedException' undeclared (first use in this funct ion) Magick.xs: In function `XS_Image__Magick_Remote': Magick.xs:12733: error: `ExceptionInfo' undeclared (first use in this function) Magick.xs:12733: error: `exception' undeclared (first use in this function) Magick.xs:12752: error: dereferencing pointer to incomplete type Magick.xs:12754: error: `MaxTextExtent' undeclared (first use in this function) Magick.xs:12754: error: `UndefinedException' undeclared (first use in this funct ion) Magick.xs: In function `XS_Image__Magick_Set': Magick.xs:12783: error: `ExceptionInfo' undeclared (first use in this function) Magick.xs:12783: error: `exception' undeclared (first use in this function) Magick.xs:12786: error: `Image' undeclared (first use in this function) Magick.xs:12786: error: `image' undeclared (first use in this function) Magick.xs:12802: error: `OptionError' undeclared (first use in this function) Magick.xs:12815: error: `MaxTextExtent' undeclared (first use in this function) Magick.xs:12815: error: `UndefinedException' undeclared (first use in this funct ion) Magick.xs: In function `XS_Image__Magick_SetPixel': Magick.xs:12850: error: `ChannelType' undeclared (first use in this function) Magick.xs:12850: error: syntax error before "channel" Magick.xs:12853: error: `ExceptionInfo' undeclared (first use in this function) Magick.xs:12853: error: `exception' undeclared (first use in this function) Magick.xs:12856: error: `Image' undeclared (first use in this function) Magick.xs:12856: error: `image' undeclared (first use in this function) Magick.xs:12862: error: `MagickBooleanType' undeclared (first use in this functi on) Magick.xs:12862: error: syntax error before "normalize" Magick.xs:12865: error: `RectangleInfo' undeclared (first use in this function) Magick.xs:12868: error: syntax error before '*' token Magick.xs:12874: error: syntax error before '*' token Magick.xs:12890: error: syntax error before ')' token Magick.xs:12892: error: `OptionError' undeclared (first use in this function) Magick.xs:12897: error: `channel' undeclared (first use in this function) Magick.xs:12897: error: `DefaultChannels' undeclared (first use in this function ) Magick.xs:12898: error: `normalize' undeclared (first use in this function) Magick.xs:12898: error: `MagickTrue' undeclared (first use in this function) Magick.xs:12899: error: `region' undeclared (first use in this function) Magick.xs:12925: error: syntax error before "option" Magick.xs:12933: error: `MaxTextExtent' undeclared (first use in this function) Magick.xs:12964: error: `MagickFalse' undeclared (first use in this function) Magick.xs:13011: error: `DirectClass' undeclared (first use in this function) Magick.xs:13012: error: `q' undeclared (first use in this function) Magick.xs:13013: error: `PixelPacket' undeclared (first use in this function) Magick.xs:13013: error: syntax error before ')' token Magick.xs:13024: error: `indexes' undeclared (first use in this function) Magick.xs:13027: error: `QuantumRange' undeclared (first use in this function) Magick.xs:13028: error: `RedChannel' undeclared (first use in this function) Magick.xs:13033: error: `GreenChannel' undeclared (first use in this function) Magick.xs:13038: error: `BlueChannel' undeclared (first use in this function) Magick.xs:13043: error: `IndexChannel' undeclared (first use in this function) Magick.xs:13044: error: `CMYKColorspace' undeclared (first use in this function) Magick.xs:13049: error: `OpacityChannel' undeclared (first use in this function) Magick.xs:13058: error: `UndefinedException' undeclared (first use in this funct ion) Magick.xs: In function `XS_Image__Magick_Statistics': Magick.xs:13113: error: `MaxTextExtent' undeclared (first use in this function) Magick.xs:13116: error: `ChannelStatistics' undeclared (first use in this functi on) Magick.xs:13116: error: `channel_statistics' undeclared (first use in this funct ion) Magick.xs:13122: error: `ExceptionInfo' undeclared (first use in this function) Magick.xs:13122: error: `exception' undeclared (first use in this function) Magick.xs:13128: error: `Image' undeclared (first use in this function) Magick.xs:13128: error: `image' undeclared (first use in this function) Magick.xs:13146: error: `OptionError' undeclared (first use in this function) Magick.xs:13156: error: syntax error before ')' token Magick.xs:13167: error: syntax error before ')' token Magick.xs:13171: error: `QuantumRange' undeclared (first use in this function) Magick.xs:13172: error: `RedChannel' undeclared (first use in this function) Magick.xs:13173: error: `GreenChannel' undeclared (first use in this function) Magick.xs:13174: error: `BlueChannel' undeclared (first use in this function) Magick.xs:13175: error: `CMYKColorspace' undeclared (first use in this function) Magick.xs:13176: error: `IndexChannel' undeclared (first use in this function) Magick.xs:13177: error: `MagickFalse' undeclared (first use in this function) Magick.xs:13178: error: `OpacityChannel' undeclared (first use in this function) Magick.xs:13179: error: syntax error before ')' token Magick.xs:13184: error: `UndefinedException' undeclared (first use in this funct ion) Magick.xs: In function `XS_Image__Magick_SyncAuthenticPixels': Magick.xs:13211: error: `ExceptionInfo' undeclared (first use in this function) Magick.xs:13211: error: `exception' undeclared (first use in this function) Magick.xs:13214: error: `Image' undeclared (first use in this function) Magick.xs:13214: error: `image' undeclared (first use in this function) Magick.xs:13217: error: `MagickBooleanType' undeclared (first use in this functi on) Magick.xs:13217: error: syntax error before "status" Magick.xs:13231: error: `OptionError' undeclared (first use in this function) Magick.xs:13238: error: syntax error before ')' token Magick.xs:13245: error: `status' undeclared (first use in this function) Magick.xs:13246: error: `MagickFalse' undeclared (first use in this function) Magick.xs:13251: error: `MaxTextExtent' undeclared (first use in this function) Magick.xs:13251: error: `UndefinedException' undeclared (first use in this funct ion) Magick.xs: In function `XS_Image__Magick_Transform': Magick.xs:13286: error: `ExceptionInfo' undeclared (first use in this function) Magick.xs:13286: error: `exception' undeclared (first use in this function) Magick.xs:13292: error: `Image' undeclared (first use in this function) Magick.xs:13292: error: `clone' undeclared (first use in this function) Magick.xs:13293: error: `image' undeclared (first use in this function) Magick.xs:13314: error: `OptionError' undeclared (first use in this function) Magick.xs:13324: error: syntax error before ')' token Magick.xs:13364: error: `next' undeclared (first use in this function) Magick.xs:13370: error: `MagickFalse' undeclared (first use in this function) Magick.xs:13378: error: `GravityType' undeclared (first use in this function) Magick.xs:13378: error: syntax error before "in" Magick.xs:13395: error: `MagickTrue' undeclared (first use in this function) Magick.xs:13396: error: syntax error before ')' token Magick.xs:13396: error: `ErrorException' undeclared (first use in this function) Magick.xs:13401: error: syntax error before ')' token Magick.xs:13413: error: `MaxTextExtent' undeclared (first use in this function) Magick.xs:13413: error: `UndefinedException' undeclared (first use in this funct ion) Magick.xs: In function `XS_Image__Magick_Write': Magick.xs:13443: error: `MaxTextExtent' undeclared (first use in this function) Magick.xs:13446: error: `ExceptionInfo' undeclared (first use in this function) Magick.xs:13446: error: `exception' undeclared (first use in this function) Magick.xs:13449: error: `Image' undeclared (first use in this function) Magick.xs:13449: error: `image' undeclared (first use in this function) Magick.xs:13450: error: `next' undeclared (first use in this function) Magick.xs:13473: error: `OptionError' undeclared (first use in this function) Magick.xs:13479: error: syntax error before ')' token Magick.xs:13493: error: dereferencing pointer to incomplete type Magick.xs:13501: error: dereferencing pointer to incomplete type Magick.xs:13501: error: `MagickTrue' undeclared (first use in this function) Magick.xs:13504: error: dereferencing pointer to incomplete type Magick.xs:13505: error: `ErrorException' undeclared (first use in this function) Magick.xs:13509: error: dereferencing pointer to incomplete type Magick.xs:13516: error: `UndefinedException' undeclared (first use in this funct ion) Magick.xs: In function `boot_Image__Magick': Magick.xs:2344: error: `MagickFalse' undeclared (first use in this function) Magick.xs:2348: warning: assignment makes pointer from integer without a cast dmake.EXE: Error code 129, while making 'Magick.o' JCRISTY/PerlMagick-6.59.tar.gz C:\strawberry\c\bin\dmake.EXE -- NOT OK Running make test Can't test without successful make Running make install Make had returned bad status, install seems impossible
cpan Win32::Capture Database was generated on Wed, 10 Feb 2010 02:51:04 GMT Running install for module 'Win32::Capture' Running make for K/KE/KENWU/Win32-Capture-1.2.zip Checksum for C:\strawberry\cpan\sources\authors\id\K\KE\KENWU\Win32-Capture-1.2. zip ok CPAN.pm: Going to build K/KE/KENWU/Win32-Capture-1.2.zip String found where operator expected at Makefile.PL line 12, near "'Win32::GUI:: DIBitmap'" (Missing semicolon on previous line?) syntax error at Makefile.PL line 12, near "'Win32::GUI::DIBitmap'" Execution of Makefile.PL aborted due to compilation errors. Warning: No success on commandC:\strawberry\perl\bin\perl.exe Makefile.PL KENWU/Win32-Capture-1.2.zip C:\strawberry\perl\bin\perl.exe Makefile.PL -- NOT OK Running make test Make had some problems, won't test Running make install Make had some problems, won't install

Replies are listed 'Best First'.
Re: screenshot module on Windows
by zentara (Cardinal) on Feb 10, 2010 at 17:59 UTC
    You can install Gtk2 on win32 fairly easily with Camelbox: A build of Gtk2-Perl for Windows. Then you can do this.
    #!/usr/bin/perl use warnings; use strict; use Gtk2 -init; use Time::HiRes qw( time ); my $time_start = time; my $s = Gtk2::Gdk::Screen->get_default; my $w = $s->get_root_window; # pixbuf = $pixbuf->get_from_drawable ($src, $cmap, $src_x, $src_y, # $dest_x, $dest_y, $width, $height +) while (1){ my $p = Gtk2::Gdk::Pixbuf->get_from_drawable ( $w, undef, 0, 0, 0, 0, $s->get_width, $s->get_height); $p->save (time.'.png', "png"); } my $time_end = time; my $diff = $time_end - $time_start; print "$diff\n";

    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku
Re: screenshot module on Windows
by BrowserUk (Patriarch) on Feb 10, 2010 at 19:22 UTC

    If you have a command line bmp to png converter (or jpg etc. like this one), then you can do this quite easily without any of the complex installs:

    #! perl -slw use strict; use Win32::GuiTest qw[FindWindowLike SetForegroundWindow SendKeys]; use Win32::Clipboard; my $clip = Win32::Clipboard->new(); my @windows = FindWindowLike( 0, $ARGV[ 0 ] ); #Find it die "Couldn't find window '$ARGV[ 0 ]" unless @windows; for (@windows) { SetForegroundWindow( $_ ); # Make it active sleep 1; ## Send the Alt-print screen key sequence to copy ## the active window to the clipboard SendKeys("%{PRTSCR}"); } my $fname = "$ARGV[ 0 ]-@{[ time() ]}"; print $fname; if( my $bitmap = $clip->GetBitmap() ) { local $\; my $bmpfile = $fname . '.bmp'; open my $bmp, '>', $bmpfile or die $!; binmode $bmp; print $bmp $bitmap; close $bmp; print "Bitmap written to $bmpfile\n"; system "bmp2png $bmpfile"; print "Converted to $fname.png"; } else { die "Couldn't get bitmap from clipboard"; } __END__ C:\test>screengrab Opera Opera-1265829469 Bitmap written to Opera-1265829469.bmp OK Opera-12658294 ooooooooooooooooooooooooooooooooooooooooooooooo +ooooo Converted to Opera-1265829469.png

    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
Re: screenshot module on Windows
by jmcnamara (Monsignor) on Feb 10, 2010 at 19:41 UTC

    It would be best to use one of the dedicated modules but in the absence of those the following simple utility might do what you need: Screen capture on Windows.

    See the full example at the linked node but here is the shorter version.

    #!/usr/bin/perl -w use strict; use Win32::Clipboard; use Win32::GuiTest 'SendKeys'; # Send "Print Screen" key to Windows. SendKeys('{PRTSCR}'); # Get the image from the clipboard. my $screen = Win32::Clipboard::GetBitmap() or die "No image captured: $!\n"; # Print the image to a file. open BITMAP, "> screen.bmp" or die "Couldn't open bitmap file: +$!\n"; binmode BITMAP; print BITMAP $screen; close BITMAP; __END__

    --
    John.

Re: screenshot module on Windows
by tonyc (Hermit) on Feb 10, 2010 at 22:06 UTC
    Could I please see the failed build log for Imager::Screenshot? I just built it successfully with the latest Strawberry Perl.