in reply to print-screen without non-core modules ?
You will need to get over your aversion to non-core modules.
I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh
The utility "import" from ImageMagick ( installed on most machines ) can capture the root window to a "blob", which can be manipulated by Imager or ImageMagick.
#!/usr/bin/perl use warnings; use strict; use Image::Magick; my $blob = `import -window root jpg:-`; #my $blob = `import -`; #postscript produced #print "$blob\n"; # now $blob is in memory and you can do what you # want with it. my $output = Image::Magick->new(magick=>'jpg'); $output->BlobToImage( $blob ); #$output->Resize(geometry=>'160x120'); $output->Write( $0.'.jpg'); # png works too # or use Imager use Imager; # Convert image my $img = Imager->new; $img->read(data=>$blob, type=>'jpeg') or die "Cannot read: ", $img->errstr; #See perldoc Imager::Transformations my $rot20 = $img->rotate(degrees=>20); $rot20->write(file=>"$0-rot20.jpg", type=>'jpeg') or die "Cannot write: ",$rot20->errstr;
I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: print-screen without non-core modules ?
by marto (Cardinal) on May 27, 2012 at 10:38 UTC | |
Re^2: print-screen without non-core modules ?
by Anonymous Monk on May 27, 2012 at 15:33 UTC | |
by zentara (Archbishop) on May 27, 2012 at 17:51 UTC |
In Section
Seekers of Perl Wisdom