Firstly I am a newbie to both Perl and ImageMagick, I have extensively read the docs to no avail so I hope there is a patient expert who can point me in the right direction.
The project is a sign builder and the critical element we are addressing here is the width of the bounding box when text is added using the best fit approach. The issue is that although the width is resized it is not resizing to the maximum height set so there is effectively padding top and bottom. The result is the width returned is therefore about 30% inaccurate which is unacceptable.
Is there an alternative approach that will allow me to completely fill the available height space ?
Is there an issue with my code which is causing this problem ?
Can the same approach be applied after arcs etc have been applied and will this return accurate results
Is there a way to explicitly measure the font bounding box height as an alternative may be to loop over the height and adjust until correct ? (not keen)
I have attached an image of the result which clearly shows the font is not resized to the maximum height, concequently making the width measurement inaccurate.
Code: Select all
my $image; $image = Image::Magick->new (size => "$display_width x $display_height" ); $image->Set(background=>"lightblue", fill=>"blue", font=>"/usr/share/fonts/truetype/arial.ttf"); $image->Set(size=>"x114"); #overall height required $image->Read("label:Yaba Daba Dooo"); $width = $image->Get('width'); $height = $image->Get('height'); $image->Read("label:".$width.'|'.$height); #returned to check output as this is a CGI returning to a browser