ashokpj has asked for the wisdom of the Perl Monks concerning the following question:
Hi All,
I am trying to take printscreen and save it is as an image file. However i get image file in bmp format using Win32::Clipboard module.
Is it possible to save image in TIFF format?.
Thanks in advance
#!/usr/bin/perl -w use strict; use Win32::Clipboard; use Win32::GuiTest qw(FindWindowLike SetForegroundWindow SendKeys); # Find a specific Window my @windows = FindWindowLike(0, qr/^Microsoft Excel/, qr/^XLMAIN$/); for (@windows) { SetForegroundWindow($_); SendKeys('{PRTSCR}'); # Alt Print Screen sleep 2; } # 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, "> pscreen.bmp" or die "Couldn't open bitmap file: $!\ +n+"; binmode BITMAP; print BITMAP $screen; close BITMAP; __END__
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: How to save the image in TIFF format by using Win32::Clipboard
by quester (Vicar) on Feb 16, 2012 at 07:39 UTC | |
Re: How to save the image in TIFF format by using Win32::Clipboard
by fisher (Priest) on Feb 16, 2012 at 07:44 UTC | |
Re: How to save the image in TIFF format by using Win32::Clipboard
by chrestomanci (Priest) on Feb 16, 2012 at 09:04 UTC | |
Re: How to save the image in TIFF format by using Win32::Clipboard
by lutok (Scribe) on Feb 16, 2012 at 11:35 UTC |
Back to
Seekers of Perl Wisdom