How to capture my desktop?

  • You can use NSTask to invoke /usr/sbin/screencapture, which can dump
    the screen to disk. Then go nuts with the resulting image.

    --
    m-s

    On 26 Feb, 2007, at 16:15, Henry Joseph W wrote:

    > Hi All.
    > My purpose is very simple:I want to capture my desktop to generate
    > an image, then do some stuff to it.
    > Or it may be not so easy to accomplish this. Can anyone give me a
    > guide?
    > Thank you for any suggestion.
  • On 2/26/07, Henry Joseph W <henry.joseph.w...> wrote:
    > Hi All.
    > My purpose is very simple:I want to capture my desktop to generate an
    > image, then do some stuff to it.
    > Or it may be not so easy to accomplish this. Can anyone give me a guide?

    How often do you want to to take a snapshot of the screen (often
    called screen scraping)?

    The fastest way to do this currently is to attach a full screen
    context to the display(s) that you want to capture then use OpenGL
    commands to read from the frame buffer using that context. However you
    may not need this level of read back performance and hence could use a
    simpler solution (for example the one Michael W. suggested).

    Note "capture" can easily be confused with capturing the screen for
    exclusive use (aka game going full screen) so just make sure to keep
    the context clear (like you did).
  • On 26 Feb 2007, at 15:13, Michael Watson wrote:

    > You can use NSTask to invoke /usr/sbin/screencapture, which can
    > dump the screen to disk. Then go nuts with the resulting image.
    >
    > On 26 Feb, 2007, at 16:15, Henry Joseph W wrote:
    >
    >> Hi All.
    >> My purpose is very simple:I want to capture my desktop to generate
    >> an image, then do some stuff to it.

    In fact there is no need to send it to a file; you can send it to the
    clipboard:

    NSArray *args = [NSArray arrayWithObjects: @"screencapture", @"-
    Sct", @"tiff", nil];
    [[NSTask launchedTaskWithLaunchPath: @"/usr/sbin/screencapture"
    arguments: args] waitUntilExit];
    NSImage *i = [[[NSImage alloc] initWithPasteboard: [NSPasteboard
    generalPasteboard]] autorelease];

    Cheers,
    Nicko
  • On Feb 26, 2007, at 5:07 PM, Nicko van Someren wrote:

    > In fact there is no need to send it to a file; you can send it to
    > the clipboard:
    >
    > NSArray *args = [NSArray arrayWithObjects: @"screencapture", @"-
    > Sct", @"tiff", nil];
    > [[NSTask launchedTaskWithLaunchPath: @"/usr/sbin/screencapture"
    > arguments: args] waitUntilExit];
    > NSImage *i = [[[NSImage alloc] initWithPasteboard: [NSPasteboard
    > generalPasteboard]] autorelease];

    Note: Your users might be surprised, or even upset, if you replace
    the contents of the clipboard without explicitly asking for
    permissions first. The general pasteboard belongs to the user, and
    should typically only be altered in response to a direct user action,
    like copy / cut.

    j o a r
  • Hi All.
    My purpose is very simple:I want to capture my desktop to generate an
    image, then do some stuff to it.
    Or it may be not so easy to accomplish this. Can anyone give me a guide?
    Thank you for any suggestion.
  • > My purpose is very simple:I want to capture my desktop to generate an
    > image, then do some stuff to it.

    Just to be clear, do you want a snapshot of your screen or just access to
    the image currently used as the desktop image?
  • Hi all,

    I've been following this discussion and looking for a "real" solution
    for this.

    I am planning to produce a screen-cast series and was surprised to
    find that solutions to screen-casting appear to be lacking in many
    ways.  I'm currently using Snapz Pro X to capture video and audio.

    The software is decent, but it lacks several features I would love to
    have:

    1. The ability to drag the video "Frame" to another part of the
    screen.  Snapz Pro X has features for following the mouse as it moves
    on the screen, but sometimes I just want to drag the window manually.

    2. Feature to pause capture during a session (without having to go
    through the entire encoding and saving process).  This really breaks
    the rhythm when recording screen-casts.

    3. A time-code track on the video (displays the time-code during
    record and playback sessions).  This should be compatible with Final
    Cut Pro and iMovie if possible.

    4. Snapz Pro X appears to be more geared to capturing still images,
    and the movie feature feels like a "half-complete add-on" to the
    program.

    Don't misunderstand me, I think Snapz Pro X is a great program.  It's
    just not the best fit for what I'm trying to accomplish.

    Problem 1.  I'm a complete noob on Mac OS X development.  I have
    gotten as far as having a decent prototype of a semi-transparent
    frame with buttons for play, record, pause, etc.  I can drag it
    around on the screen and resize it to indicate the portion of the
    screen to record.  That's where I got stuck.  I only know how to
    capture the content of that window (or portion of that window), but
    what I need is the fully composited frames from the desktop all the
    way through any other application's views contained within the
    designated "record" rectangle.

    I assume to do this the software must be able to "grab" pixel data
    directly out of the final screen buffer that gets pushed to the video
    memory of the display hardware.  I'm guessing this would be an OpenGL
    operation.

    Problem 2.  I know nothing about OpenGL at this point.  So, while I
    feel I could handle the basic needs of my application, I don't feel
    that I can reasonably handle the OpenGL work necessary to capture
    pixel data.  I'm not sure yet about how to capture that pixel data to
    QuickTime, but that sounds like a fun bit of research.

    Sorry for the long post, but my point is this: is there anyone out
    there that would be willing, or have the time, to develop the OpenGL
    pixel data capture feature.  I would be willing to pay a reasonable
    fee for the solution.  Lets just ball park it at 3x the cost of Snapz
    Pro X, which is roughly around $200.00.  Any experienced OpenGL
    programmers please email me off-list if interested.

    On Feb 26, 2007, at 4:15 PM, Henry Joseph W wrote:

    > Hi All.
    > My purpose is very simple:I want to capture my desktop to generate
    > an image, then do some stuff to it.
    > Or it may be not so easy to accomplish this. Can anyone give me a
    > guide?
    > Thank you for any suggestion.

    --
    Robert Walker
    <robertwalker1...>
previous month february 2007 next month
MTWTFSS
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28        
Go to today