When you use "import" for a screenshot, it requires a filename to write to. This can be a hassle sometimes. Here is a trick I came across to capture the screenshot to memory. I still need to use backticks to run import, and if anyone knows how to do this from PerlMagick, your input would be appreciated.
#!/usr/bin/perl
use warnings;
use strict;
use Image::Magick;
my $blob = `import 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(time.'.jpg');
Re: Screenshot to memory with ImageMagick
Why not just use
`import - file_name_based_on_current_date_time.format`
Re^2: Screenshot to memory with ImageMagick
I think you were missing the point. When you use import, it needs a filename, but what if you want to do something else with the image. You then need to reopen the file and process it. The way I showed avoids the need to reopen the file. It can also be used to send screenshots, without even writing a local copy, like thru email or ftp, or something.
I'm not really a human, but I play one on earth.
flash japh
Re^3: Screenshot to memory with ImageMagick
Aha, now I grok it :-)
I really misunderstood you.