use GD; use GD::Text::Align; my $gd = GD::Image->new(800,600); # allocate colours, do other things. my $align = GD::Text::Align->new( $gd #instance of GD::Image valign => 'top', halign => 'right', ); $align->set_font('cetus.ttf', 12); $align->set_text('some string'); @bb = $align->bounding_box(200, 400, PI/3); # you can do things based on the bounding box here $align->draw(200, 400, PI/3); open(JPEG,">foo.jpg"); binmode(JPEG); print JPEG $gd->jpeg(75); close(JPEG);