Thanks! The problem here is actually fairly straight forward: $image->[1] is not defined. To verify this, try running the code below, which is a trimmed version of what you provided. You'll notice that I added a few print statements, for $x in the for-loop and for $p after we get it from $image->[1]. You'll notice that (1) no numbers print and (2) we get the warning "Use of uninitialized value $p in concatenation..." arising from printing $p. So, what ever you are trying to do is not doing what you think it is doing. :-/
This looks like it is a bunch of example scripts cobbled together. Do you have an example of just how to convolve an image? David ------------------%<---------------------------- use strict; use warnings; use Image::Magick; # The script reads three images, crops them, and writes a single image as a GIF animation sequence my($image,$p,$q); $image = new Image::Magick; $image->Read('Bugs_Bunny.svg.png'); $image->Read('ng-clipart-bugs-bunny-witch-hazel-drawing-looney-tunes-cartoon-bugs-and-lola-bunny.png'); $image->Read('k.miff[1, 5, 3]'); $image->Contrast(); for(my $x = 0; $image->[$x]; $x++){ print "$x\n"; $image->[$x]->Frame('100x200') if $image->[$x]->Get('magick') eq 'GIF'; } $p = $image->[1]; print "$p\n"; $p->Convolve([1, 2, 1, 2, 4, 2, 1, 2, 1]); On Fri, Feb 4, 2022 at 11:05 AM William Torrez Corea <willitc9...@gmail.com> wrote: > #!/usr/local/bin/perl >> use Image::Magick; >> use PDL::ImageND; >> >> # The script reads three images, crops them, and writes a single image as >> a GIF animation sequence >> my($image,$p,$q); >> >> $image = new Image::Magick; >> $image->Read('Bugs_Bunny.svg.png'); >> >> $image->Read('ng-clipart-bugs-bunny-witch-hazel-drawing-looney-tunes-cartoon-bugs-and-lola-bunny.png'); >> $image->Read('k.miff[1, 5, 3]'); >> $image->Contrast(); >> for($x = 0; $image->[$x]; $x++){ >> $image->[$x]->Frame('100x200') if $image->[$x]->Get('magick') eq >> 'GIF'; >> undef $image->[$x] if $image->[$x]->Get('columns') < 100; >> } >> >> $p = $image->[1]; >> >> # Suppose you want to start out with a 100x100 pixel white canvas with a >> red >> $image = Image::Magick->new; >> $image->Set(size=>'100x100'); >> $image->ReadImage('canvas:white'); >> $image->Set('pixel[49,49]'=>'red'); >> >> # Here we reduce the intensity of the red component at (1,1) by half: >> @pixels = $image->GetPixel(x=>1,y=>1); >> $pixels[0]*=0.5; >> $image->SetPixel(x=>1,y=>1,color=>\@pixels); >> >> # Or suppose you want to convert your color image to grayscale >> $image->Quantize(colorspace=>'gray'); >> >> # Let's annotate an image with a taipai truetype font >> $text = 'Works like magick!'; >> $image->Annotate(font=>'kai.ttf', >> pointsize=>40,fill=>'green',text=>$text); >> >> # Perhaps you want to extract all the pixel intensities from an image and >> write them to STDOUT >> @pixels = $image->GetPixels(map=>'I', >> height=>$height,width=>$width,normalize=>true); >> binmode STDOUT; >> print pack('B*',join('',@pixels)); >> >> # Other clever things you can do with a PerlMagick objects include >> $i = "$#$p+1"; # return the number of images associated with object p >> push(@$q, @$p); # push the images from object p onto object q >> @$p = (); #delete the images but not the object p >> $p->Convolve([1, 2, 1, 2, 4, 2, 1, 2, 1]); >> > > On Fri, Feb 4, 2022 at 9:41 AM David Mertens <dcmertens.p...@gmail.com> > wrote: > >> The issue isn't having the method, the issue is calling it on an >> unblessed reference. Can you show the code that gives this problem? >> >> Btw, my bet is that it's not a matter of having PDL's method. You would >> use PDL for number crunching, not gif animation. :-) >> >> David >> >> On Fri, Feb 4, 2022, 10:14 AM William Torrez Corea <willitc9...@gmail.com> >> wrote: >> >>> Ready, install the method from https://metacpan.org/pod/PDL::ImageND. >>> >>> $p->Convolve([1, 2, 1, 2, 4, 2, 1, 2, 1]); >>>> >>> >>> >>> According to the function convolve this declaration is of the following >>> way >>> >>>> $new = convolve $x, $kernel >>>> >>>> But when I declare the function in my code the result is wrong. >>> >>> Can't call method "Convolve" on unblessed reference at gifaninmation.pl >>>> line 47. >>>> >>> >>> I don't know in what part I am confused. >>> >>> >>> >>> >>> >>> >>> On Fri, Feb 4, 2022 at 8:34 AM Andrew Solomon <and...@geekuni.com> >>> wrote: >>> >>>> Is this what you're looking for? >>>> >>>> https://metacpan.org/pod/PDL::ImageND >>>> >>>> >>>> On Fri, Feb 4, 2022 at 2:30 PM William Torrez Corea < >>>> willitc9...@gmail.com> wrote: >>>> >>>>> I'm using cpanm trying to find a method that contains the function >>>>> convolve but I only found the method Imager. >>>>> >>>>> https://metacpan.org/pod/Imager >>>>> >>>>> When I try to declare the method and use it in the code, the result is >>>>> always wrong. >>>>> >>>>> I am using the following libraries: >>>>> >>>>>> >>>>>> >>>>>> >>>>>> *#!/usr/local/bin/perl use Image::Magick;use Imager;* >>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> >>>>> With kindest regards, William. >>>>> >>>>> ⢀⣴⠾⠻⢶⣦⠀ >>>>> ⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system >>>>> ⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org >>>>> ⠈⠳⣄⠀⠀⠀⠀ >>>>> >>>>> >>>> >>>> -- >>>> Andrew Solomon >>>> Director, Geekuni <https://geekuni.com/> >>>> P: +44 7931 946 062 >>>> E: and...@geekuni.com >>>> >>> >>> >>> -- >>> >>> With kindest regards, William. >>> >>> ⢀⣴⠾⠻⢶⣦⠀ >>> ⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system >>> ⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org >>> ⠈⠳⣄⠀⠀⠀⠀ >>> >>> > > -- > > With kindest regards, William. > > ⢀⣴⠾⠻⢶⣦⠀ > ⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system > ⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org > ⠈⠳⣄⠀⠀⠀⠀ > > -- "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." -- Brian Kernighan