However, in the following, only 'size' returns what was set in new(): depth returns incorrectly as 16, not 8, and the rest of the attributes return EMPTY.
For a time I wondered if, because $image can contain multiple images, I should be "dereferencing" it in order to Get() attributes (for example, like $image->->Get()), but I found examples where an $image with a single member did not resort to the index.
I only recently installed v7.0.8 from source and although it passed 'make check', I suppose it could be broken.
Can you suggest anything?
[EDIT: here's what's returned]
Size:100x1 Depth:16 Magick: W: H: Matte: Alpha: Fill:
Code: Select all
#!/usr/bin/perl use strict; use Image::Magick; my @pixel=(0.5,0.5,0.5,1); # from: https://imagemagick.org/script/perl-magick.php#overview # "The new() method takes the same parameters as SetAttribute." my $image = Image::Magick->new( size=>'100x1', depth=>8, magick=>'PNG', alpha=>'Transparent', matte=>'True', fill=>\@pixel ); #$image->Set(depth=>8); $image->Set('depth'=>8); # quoted or not, the result is '16' (??) # from: https://imagemagick.org/script/perl-magick.php#set-attribute # "...here is a list of all the image attributes you can set:" # from: https://imagemagick.org/script/perl-magick.php#get-attribute # "In addition to all the attributes listed in Set an Image Attribute, # you can get ... additional attributes:" # NOTE: Get() arguments are quoted because Perl complains about them being "barewords" under 'use strict' my $z=$image->Get('size'); # NOTE: even though 'size' is quoted here, it was unquoted in new() but it's still found correctly my $d=$image->Get('depth'); NOTE: depth was defined as 8 in new() and Set() to 8 as well, but Get()s as 16 (??) my $g=$image->Get('magick'); # EMPTY my $c=$image->Get('columns'); # EMPTY my $r=$image->Get('rows'); # EMPTY my $t=$image->Get('matte'); # EMPTY my $a=$image->Get('alpha'); # EMPTY my @f=$image->Get('fill'); # EMPTY print "Size:$z Depth:$d Magick:$g W:$c H:$r Matte:$t Alpha:$a Fill:@f\n";