perl - Crop image using GD library -


i using gd library in perl script allows me draw true-type-font text. because don't know exact size @ beginning, set

my $i = new gd::image(3000, 3000); 

and draw text

my $black = $i->colorallocate(0, 0, 0); @b = $i->stringft($black, './ttf/cour.ttf', 12, 0, 0, 0, "\n$text"); 

where @b contains crop data.

i wish execute (incorrect syntax):

$i->crop(0, 0, $b[2], $b[3]); 

...but there no such crop function available.

how can crop image? there known work-around?

typically use the "copy" methods of gd move selected data 1 image new image.

or if need compute width , height of strings drawn gd, check out gd::text.


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -