in reply to Re^5: Howto convert Image::Grab jpg object to Image::Magick object???
in thread Howto convert Image::Grab jpg object to Image::Magick object???

Hi
This code did the job for me.

#get the latest image from the IP camera my $snapshot = new Image::Grab; $snapshot->ua->timeout(5); #sets the timeout (sec) for image::grab (d +efault is 180s) $snapshot->url("$Camera{$key}"); # create the grab object $snapshot->grab; # grab the image mark_blob(my $jpg); # mark as a binary variable $jpg = $snapshot->image; # Convert to Image::Maggick image my $pic = Image::Magick->new(magick=>'jpg'); # create new image obje +ct $pic->BlobToImage($jpg); #convert the grabbed blob image to Image::Ma +gick object
  • Comment on Re^6: Howto convert Image::Grab jpg object to Image::Magick object???
  • Download Code

Replies are listed 'Best First'.
Re^7: Howto convert Image::Grab jpg object to Image::Magick object???
by Anonymous Monk on Apr 14, 2017 at 11:02 UTC
    What is "mark_blob"? It's probably not needed...
      See the BLOB module.

      It simply marks the variable as a BLOB.
      I don't know how the insides of the compiler works (and I am not going to look), but pre-defining the variable type should make the code run faster.
      Even if it doesn't, at least it should make the code easier to read in the distant future when I come back to modify it.