Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

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

by dazz (Beadle)
on Mar 27, 2017 at 19:47 UTC ( [id://1186135]=note: print w/replies, xml ) Need Help??


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

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

  • Comment on Re^5: Howto convert Image::Grab jpg object to Image::Magick object???

Replies are listed 'Best First'.
Re^6: Howto convert Image::Grab jpg object to Image::Magick object???
by dazz (Beadle) on Apr 14, 2017 at 08:07 UTC
    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...
        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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1186135]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (2)
As of 2024-04-26 05:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found