Imager - Floating point exception when drawing text on png image

Posted on Tue Jun 12 13:43:25 2007 by letox
Floating point exception when drawing text on png image
Hi.

I am using Imager for some time now and you do a great job.

I have got a problem now. When I open a png image and try to render text using arial.ttf I get a floating point exception.

I am using Debian sarge with the libfreetype6-dev 2.1.7-6 package and Imager 0.58.

The perl file looks like this:

use Imager; my $img = Imager->new (); $img->read (file => 'scaah_style4i7.png'); my $black = Imager::Color->new (0,0,0,255); my $font = Imager::Font->new (file => 'arial.ttf', color => $black, size => 11, aa => 1); $img->string (color => $black, font => $font, x => 10, y => 10, size => 11, sizew => 11, text => 't +est', aa => 1); $img->write (file => 'test.png');

If you need the image to reproduce the issue you can find it at http://www.lazyturtle.net/scaah_style4i7.png

At the moment I use the following workaround: I remove the alpha channel with convert (preset noalpha). Is there a way to re-apply the alpha channel after rendering the text? I could save it with convert (preset alpha) but I havent found a way to add a one-channel image as a new alpha channel to a three-channel image.

Thanks in advance,
Hendrik
Direct Responses: 5405 | 5442 | Write a response