I am currently using Win32::GuiTest to try and automate a series of screen captures, but I need to do some analysis of each captured image before deleting them.

Presently, I've resorted to saving them to disk and then parsing the resulting BMP back into memory before pondering the pixel grid:

sub grabWindowRegion { my $ds = new Win32::GuiTest::DibSect; $ds->CopyClient(shift,[@_]); $ds->SaveAs('temp.bmp'); return parseBMP('temp.bmp'); }
Writing to disk just to immediately read it back is really silly and wasteful, but I needed to just get it done.

The DibSect object is opaque ($VAR1 = bless( do{\(my $o = 28375616)}, 'Win32::GuiTest::DibSect' );) to naive Dumpering, and I'm not seeing any perl source for it in the install directories.

In the end, I just want a 2D grid of pixel colors in an AoA ref or equivalent. At a minimum, the ability to peek at pixel values in the image.
How should I be doing this?

Current Solution:

  1. SendKeys('^{PRTSCN}');
  2. my $image = Win32::Clipboard::GetBitmap();
  3. Crop separately


In reply to Win32::GuiTest - Processing screen captures in memory? by SuicideJunkie

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.