I am using GD library in my Perl script that allows me to draw a true-type-font text. Because I don't know exact size at the beginning, I set
my $i = new GD::Image(3000, 3000);
and then I draw my text
my $black = $i->colorAllocate(0, 0, 0);
my @b = $i->stringFT($black, './ttf/cour.ttf', 12, 0, 0, 0, "\n$text");
where @b
contains my crop data.
I wish to execute something like this (incorrect syntax):
$i->crop(0, 0, $b[2], $b[3]);
...but there is no such crop
function available.
How can I crop my image? Is there some known work-around?