my $font = GD::Font->load($font_path) or die('cant load font'); $image->string($font,50,30,$content,$red); exit; #### #!/usr/bin/perl use strict; use Cwd; use Carp; use GD; my $font_arg ='/home/leo/misc/fonts/Suicide.ttf'; #/usr/share/fonts/ttf/unvr57w.ttf'; my $jpeg_quality=90; my $content = `date`; my $out = sprintf "/tmp/%s.jpg", time; -f $font_arg or die; # just in case my $font = GD::Font->load($font_arg) or die('cant load font'); # error here # create a new image my $image = new GD::Image(700,350); my $red = $image->colorAllocate(255,0,0); $image->string($font,50,30,$content,$red); # not making it to this line open(DATEI ,'>', $out) || die "could not write image: +$!"; binmode DATEI; print DATEI ($image->jpeg($jpeg_quality)); close(DATEI); warn "saved $out\n"; exit; #### [leo@mescaline ~]$ file /home/leo/misc/fonts/Suicide.ttf /home/leo/misc/fonts/Suicide.ttf: TrueType font data