dynamically generating graphics

Discussion in 'Perl Misc' started by MJL, Sep 17, 2003.

  1. MJL

    MJL Guest

    Is it difficult to dynamically generate a jpg in PERL? For example,
    create a pie-chart or other graphs? What about including other
    images?

    I would like to dynamically create jpg's or gif's for my website and I
    heard that it can be done in PERL.

    Thanks!

    mjl
     
    MJL, Sep 17, 2003
    #1
    1. Advertisements

  2. I don't know about PERL, but with Perl you can use modules.

    You can use Imager, Image::Magick, or GD. Or you can use any other
    package that creates some sort of bitmap and convert it to JPEG format
    with Image::Magick or some such.

    See your local CPAN mirror, or start at http://search.cpan.org/.
    There are already modules available on CPAN. See abovementioned URL.
    GD::Graph is one that I know particularly well, but there are several
    others.

    It'd be better to create PNG files instead of JPEG, though. JPEG's
    compression algorithm isn't very good at images with typical charts.
    Most free modules at the moment don't do GIF because of the patenting
    issues involved. GIF is inferior to PNG for this sort of thing
    (anything, really) anyway. JPEG is not a good file format for charts.
    Please, stop saying PERL. It hurts.

    Martien
     
    Martien Verbruggen, Sep 17, 2003
    #2
    1. Advertisements

  3. Its easy once you know how. Use the GD module
    http://search.cpan.org/author/LDS/GD-2.07/GD.pm
    Gifs are only supported up to Version 1.18 of GD (which is still available
    for download); the latest version of GD uses png as the graphics format.

    Have at look at the stock market charts at my site www.ipo-australia.com to
    give you some basic ideas.

    gtoomey
     
    Gregory Toomey, Sep 17, 2003
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.