Using ImageMagick on the command line, I can say
convert -background '#0000' -fill white -stroke black -strokewidth 3 -gravity center -pointsize 78 -size 568x1000 caption:'Lorem ipsum etc etc' -trim +repage out.png
And create the conclusion I'm looking for. What I would like to do is the same thing, but inside PerlMagick, so I don’t need to continue reading and writing files when I follow other steps. That's what i still have
use strict;
use warnings;
use Image::Magick;
my $im = new Image::Magick;
my $e = $im->Set(
background => '#0000',
fill => 'white',
stroke => 'black',
strokewidth => 3,
gravity => 'center',
pointsize => 78,
size => '586x1000',
);
die $e if $e;
$e = $im->Read("caption:Lorem ipsum etc etc");
die $e if $e;
$e = $im->Trim();
die $e if $e;
$e = $im->Set(page=>'0x0+0+0');
die $e if $e;
$e = $im->Write('out.png');
die $e if $e;
And it works exactly the same, except that the resulting text is not centered.
There is virtually no documentation for PerlMagick. I based this "read header" syntax on some MagicWand examples, which claim that this will lead to centered text. Obviously, there is something else for PerlMagick.
, : PerlMagick ? , PerlMagick? , , . , .
, - Annotate, .
: , -caption , , , : -. -, , .
EDIT 2: .
use strict;
use warnings;
use Image::Magick;
my $im = new Image::Magick;
my $e = $im->SetAttribute(
background => '#0000',
pointsize=>12,
size => '100x100',
gravity => 'center',
);
die $e if $e;
$e = $im->ReadImage('caption:The quick brown fox jumps over the lazy dog.');
die $e if $e;
$e = $im->Write('out.png');
die $e if $e;
: .
: .
:
convert -background '#0000' -size 100x100 -pointsize 12 -gravity center caption:'The quick brown fox jumps over the lazy dog.' out.png
perlmagick , SetAttribute, , . ? , ?