From c1df1f3db991a3f40c8d1862b6d459142b96a902 Mon Sep 17 00:00:00 2001 From: silverwizard Date: Fri, 6 Dec 2019 00:42:01 -0500 Subject: [PATCH] Slight card modifications, added background image extension --- Backgrounds/.gitkeep | 0 CardGen.pl | 9 ++++++--- shopping.yml | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) create mode 100644 Backgrounds/.gitkeep diff --git a/Backgrounds/.gitkeep b/Backgrounds/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/CardGen.pl b/CardGen.pl index 91ba66f..1d81e08 100755 --- a/CardGen.pl +++ b/CardGen.pl @@ -51,10 +51,13 @@ foreach my $card (keys %{$cards->{Deck}->{Cards}}){ $image->Annotate(text => wrap('', '', $card), x => 50, y => 100, font => $mainfont, fill => $txtcolour, pointsize => 60); my $newlines = () = $text =~ /(\n)/g; $image->Annotate(text => $text, x => 50, y => (750-(25*$newlines)), font => $mainfont, fill => $txtcolour, pointsize => 25); + my $backgroundfilename = "Backgrounds/" . $card . ".png"; + if(-e $backgroundfilename){ + my $background = Image::Magick->new; + $background->ReadImage($backgroundfilename); + $image->Composite(compose => 'Atop', image => $background, gravity => 'Center'); + } $image->Write($card . '.png'); } -#my $body = Image::Magick->new; -#$body->ReadImage('mayhemtraining9.png'); -#say $image->Composite(compose => 'over', image => $image, x => 100, y => 165); diff --git a/shopping.yml b/shopping.yml index fec39ed..49aa34d 100644 --- a/shopping.yml +++ b/shopping.yml @@ -1,7 +1,7 @@ Deck: - Background: black + Background: white Font: Courier - TextColour: green + TextColour: black BorderColour: green Cards: Leg Boost: