Find the answer to your Linux question:
Results 1 to 7 of 7
Hi, I need to write a program that can take snapshot of the entire desktop, store the image data in an array and then optionally save the array data as ...
  1. #1
    Just Joined! asadujjaman's Avatar
    Join Date
    Apr 2007
    Location
    ~
    Posts
    51

    Taking Screenshot in linux Programmatically

    Hi, I need to write a program that can take snapshot of the
    entire desktop, store the image data in an array and then
    optionally save the array data as a Bitmap image on disk or
    display it in another window.

    I used to take screenshot in windows by first calling the
    hdc = GetDC(GetDesktopWindow())
    Then create a compatible DC and perform BitBlt().
    How do i GetDesktopWindow() in linux. What about BitBlt()
    Is it possible to access the display driver directly to accomplish
    this?

    Please help.

  2. #2
    Just Joined!
    Join Date
    Apr 2007
    Posts
    6

    imagemagick

    Hi asadujjaman,
    If you have imagemagick installed, you can use this command:
    import -window root screenshot.png

  3. #3
    Linux Newbie
    Join Date
    Feb 2007
    Location
    hyderabad, india
    Posts
    247

    hi

    Quote Originally Posted by sangoma23 View Post
    Hi asadujjaman,
    If you have imagemagick installed, you can use this command:
    import -window root screenshot.png
    hi
    i trie like this
    [root@localhost untitledfolder]# import -window root screenshot.png
    [root@localhost untitledfolder]#
    is this taken the screenshot now.
    if yes, where it is saved.
    if no, how can i do this.

    help me
    thank you in advance
    "Relationships are built on trust and communication"

  4. #4
    Just Joined!
    Join Date
    Apr 2007
    Posts
    6
    It didn't give you an error message so i'm guessing the command was found and worked. Have a look in the director that you ran the command ie. 'untitledfolder' and you should see a file called screenshot.png. Open with an image editor/viewer.

  5. #5
    Just Joined! asadujjaman's Avatar
    Join Date
    Apr 2007
    Location
    ~
    Posts
    51

    I need to do it programmatically

    Can anybody give me some code example or api reference?

  6. #6
    Linux Enthusiast
    Join Date
    Jul 2005
    Location
    Maryland
    Posts
    521
    Quote Originally Posted by asadujjaman View Post
    Can anybody give me some code example or api reference?
    one thing you can do is look at the source code of imagemagick.

  7. #7
    Just Joined! asadujjaman's Avatar
    Join Date
    Apr 2007
    Location
    ~
    Posts
    51

    .......

    Quote Originally Posted by pavlo_7 View Post
    one thing you can do is look at the source code of imagemagick.
    ya. good advice.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...