You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
1.2 KiB
32 lines
1.2 KiB
use YAML::XS qw(LoadFile);
|
|
use Image::Magick;
|
|
use Text::Wrap;
|
|
|
|
$Text::Wrap::columns = 30;
|
|
|
|
my $cards = LoadFile('shopping.yml');
|
|
my @card_table;
|
|
foreach my $card (keys %{$cards->{Cards}}){
|
|
my $image = Image::Magick->new(size=>'600x825');
|
|
$image->ReadImage('canvas:white');
|
|
$image->Draw(stroke=>'red', fill => 'none', strokewidth=>1, primitive=>'rectangle', points=>'38,38 562,787');
|
|
my $surface = Image::Magick->new;
|
|
$surface->ReadImage('surface-p17.jpg');
|
|
$surface->Rotate(90);
|
|
$surface->Resize('600x825!');
|
|
$image->Composite(compose => 'over', image => $surface, x => 0, y => 0);
|
|
$image->Annotate(text => $card, font => 'Courier.ttf', y => -275, fill => 'black', pointsize => 70, gravity => 'Center');
|
|
my $text;
|
|
$image->Set(font => 'Courier', pointsize => 25);
|
|
foreach my $line (@{$cards->{Cards}->{$card}}){
|
|
$text = $text . wrap('', '', $line) . "\n";
|
|
}
|
|
$image->Annotate(text => $card, x => 50, y => 100, font => 'Courier', fill => 'black', pointsize => 35);
|
|
$image->Annotate(text => $text, x => 50, y => 600, font => 'Courier', fill => 'black', pointsize => 25);
|
|
$image->Write($card . '.png');
|
|
}
|
|
|
|
|
|
#my $body = Image::Magick->new;
|
|
#$body->ReadImage('mayhemtraining9.png');
|
|
#say $image->Composite(compose => 'over', image => $image, x => 100, y => 165);
|
|
|