Visit our Sponsor   Visit our Sponsor
delphi3000.com - the free delphi knowledge platform
delphi3000.com - the free delphi knowledge platform
Have a look at your member-status

connecting people's knowledge


  - Recent ArticlesRSS feed for Recent Articles on delphi3000.com
  - List of All Articles
  - Top Viewed Articles
  - Articles (+Attachem.)
  - Articles Of Interest
  - Categories
  - Top Uploader
  - Search
  - Index

  - My Home
  - Submit an Article
  - My Articles
  - My Personal Data
  - My Bookmarks
  - Activities
  - Login/Logout

  - Sign Up
  - Why Sign Up
  - Newsletter

  - Press
  - Advertise

  - Contact
  - Feedback





Community
Borland
ClubeDelphi
Dr. Bob
UK-BUG
Delphi Meetings
Planeta Delphi







Startblatt.de






Share this article with friendsShare this article with friends
Rate this articleRate this article - to keep the quality of delphi3000.com !
Comment this article or read through previous comments (3)


Screencapture with animated gif support!Component available for this articleFormat this article printer-friendly!Bookmark function is only available for registered users!
Capture screenshots to BMP, JPG, GIF and even Animated GIF's
Product:
Delphi all versions
Category:
Graphic
Skill Level:
Scoring:
Last Update:
11/05/2002
Search Keys:
delphi delphi3000 article borland vcl code-snippet screenshot screencapture gif animated-gif capture shot graphics
Times Scored:
2
Visits:
6136
Uploader: Christiaan ten Klooster
Company: TSP Computerdiensten
Reference: http://www.tsp2000.tmfweb.nl
Component Download: http://www.delphipages.com/uploads/Graphics/tspScreenCapII.zip
 
Question/Problem/Abstract:
How to create a screenshot of the entire screen, a selection or a specific window to a bitmap, jpeg compressed or (animated) GIF file?
Answer:



In may last year i promised to create a component which could
take screenshots and save them in a gif image, and here it
FINALLY is. :)

This component can be used in ANY kind of application, royalty
free with only 1 demand: credits!

==============================================================

Description:

This component can create screenshots of the screen (or
portions of the screen).

You can set a region of what you want to "photograph" by
calling the function

=> TtspScreenCapture.SetRegion(ARegion: TCaptureRegion)

After setting the region you must specify a capture mode.
there are 4 capturemodes:

- cmStillBitmap
- cmStillJPEG
- cmStillGIF
- cmMotionGIF

Now you can take a still image by calling the function

=> TtspScreenCapture.GetStillImage: TCaptureResult;

According to the chosen capture mode you can access the
screenshot in the proper TGraphic object:

=>   TCaptureResult = record
VBitmap: TBitmap;
     VJPEG: TJPEGImage;
     VGIFImage: TGIFImage;
      end;

With these objects you can save the images to wherever you want
them.

Motion gifs require a little different approach.

First you must set the capture mode to cmMotionGIF.
Accordingly you must set the interval in which a screenshot
should be taken by setting the property

=> TtspScreenCapture.MotionGifInterval: integer

This property is in milliseconds. (1 second = 1000 millisecond)

Everything is now ready for capturing.

To activate the capturing set the property

=> TtspScreenCapture.Active: boolean;

to true.

while capturing you can read the current GIFImage by calling the
function

=> TtspScreenCapture.GetMotionGif: TGIFImage;

To stop capturing set the Active property back to false.

The final Gif image is again accesible by calling the function
GetMotionGIF.

======================================================================

Benchmark:

The component also contains a function benchmark. this is a very simple
function which calculates how much frames can be captured in 10 seconds.

the result value is in captured frames per second (rounded).

=======================================================================

well, this wraps it up for now.

Good luck with using this component in your application!

Nevertheless i have 1 more thing to tell you:

1. DON'T forget to credit me in your application. You got this for free
   so it would be quite fair to do this simple thing.

========================================================================

Have fun,

Christiaan ten Klooster
webmaster@tsp2000.tmfweb.nl
www.tsp2000.tmfweb.nl





Please rate this article!
Skill level:
BeginnerExpert

Useful:
No!Very!

Overall rating:
PoorExcellent



Comments to this article
Write a new comment
Can figer it out
    lkdshgwipaeuh ;jlksdg;phgd (Sep 16 2003 3:25AM)

I looked though your source and couldnt find the functions you named. help please
Respond

Comment
    Erwin Haantjes (May 12 2003 8:35PM)

Nice thing but i have two comments:
- It would be nice that it is possible to include the mousecursor.
- Why you are using two units (one with less code in it) for one single component?
- Your source is undocumented (i can understand it but maybe others don't)
Respond

RE: Comment
TenKSupport (May 13 2003 6:09PM)

Hi,

Yeah i know. I created the base capture for inheriting purposes only. It is not neccesary to create 2 components, but i needed the base capture object for other purposes.

I didnt document the source code because i didn't have the time. See the readme file for details about usage.

Yours,
  Christiaan ten Klooster
Respond














 
Sign up to consume product discounts for Bronze memberships !

read more


  Visit our Sponsor

 

  Community Ad of
R. Lefter
 
   














 







     
  Copyright © 2000 - 2007 delphi3000.com - All rights reserved. Terms of use. || Privacy
delphi3000.com is a service by bluestep.com IT-Services GmbH (Vienna)