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

For this example code, I'm not sure if you need the conversion to GD, since Image::Magick supports a ->Draw command. Here's another untested copy-n-paste from the docs you could try:

$image->Draw(stroke=>'red', primitive=>'rectangle', points=>20,20 100, +100');

Where $image is an Image::Magick object.

Replies are listed 'Best First'.
Re^5: Howto convert Image::Grab jpg object to Image::Magick object???
by dazz (Beadle) on Mar 27, 2017 at 19:47 UTC

    Hi

    The GD is irrelevant in this case but it gives me a template to follow when applied to Image::Get and Image::Magick. I had found your docs reference but it doesn't show me how to pass an image from one object to a different type of object.

    Thanks for your time looking at this

      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
        What is "mark_blob"? It's probably not needed...