Code: Select all
convert input.png -alpha set -channel A -evaluate set 50% output.png
Code: Select all
convert input.png -alpha set -channel A -evaluate set 50% output.png
Yeah, I saw the Evaluate method, and it looked like the way, but syntax examples were lacking. How does 'evaluate set 50%' translate into working perlmagick? The guesswork perl I've tried so far hasn't worked at all...snibgo wrote: ↑2018-04-02T06:32:05-07:00I don't use Perl, but the documentation http://www.imagemagick.org/script/perl-magick.php says there is an "Evaluate()" method. Doesn't that work?
Code: Select all
## Read input image.
my $file = "sample.png" ;
open(IMAGE, $img) ;
my $img = Image::Magick->New(quality => 100) ;
$img->Read(file => \*IMAGE) ;
close(IMAGE) ;
## Half transparency. Still doesn't work :-(
$img->Set( alpha => 'Set' ) ;
$img->Evaluate( channel => 'A', operator => "Set", value => 50 ) ;
## Save output image.
$img->Write(
filename => 'out.png',
quality => 100,
) ;
Code: Select all
$img->Set( alpha => 'Set' ) ;
$img->Evaluate( channel => 'Alpha', operator => "Multiply", value => .5 ) ;