nofernandes has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks!!

I was wondering if in Perl exists a Module to transform text to an image on the fly!!

The idea is to upload text to a server and automatically transform this text to an image in a format like jpeg, or png or gif!!

Is perl the best language to do this!!!??

Does someone has an idea of how to do this!!

Thank you...

Nuno

Replies are listed 'Best First'.
(jeffa) Re: Transforming Text to Image!!
by jeffa (Bishop) on Jul 22, 2003 at 17:43 UTC
    This is trivial with the GD module. From the docs:
    my $im = GD::Image->new(100,100); $im->string(gdSmallFont,2,10,"Peachy Keen",$color); binmode STDOUT; print $im->png;
    Look in the docs for the 'Character and String Drawing' section for more.

    jeffa

    L-LL-L--L-LL-L--L-LL-L--
    -R--R-RR-R--R-RR-R--R-RR
    B--B--B--B--B--B--B--B--
    H---H---H---H---H---H---
    (the triplet paradiddle with high-hat)
    
Re: Transforming Text to Image!!
by naChoZ (Curate) on Jul 22, 2003 at 17:43 UTC
Re: Transforming Text to Image!!
by dga (Hermit) on Jul 22, 2003 at 17:44 UTC

    You might want to look into Image::Magick which is on CPAN under Perl-Magick. This assumes that you want to make a graphical image out of some text string that is sent in.

    I would recommend png for the file format to best preserve the look of the text in the least proprietary way.

    A graphic file of a sentance will be orders of magnitude larger to store than the sentance.

    GD might also do this sort of thing.

Re: Transforming Text to Image!!
by glwtta (Hermit) on Jul 23, 2003 at 01:34 UTC
    small suggestion?

    s/([!?])+$/$1/;

    :)

Re: Transforming Text to Image!!
by YAFZ (Pilgrim) on Jul 23, 2003 at 13:03 UTC
Re: Transforming Text to Image!!
by nofernandes (Beadle) on Jul 22, 2003 at 17:56 UTC

    Thank you very much!!

    You´ve been very helpfull!!

    I´m gonna investigate!!

    Nuno
      I always smile when I see your postings.
      You're just so.... enthusiastic.
      ;-)
Re: Transforming Text to Image!!
by monkey_boy (Priest) on Jul 23, 2003 at 15:46 UTC
    If your on a linux style system, the prog. text2gif offers an extremly simple (but also limmited) solution.